Batch file problem in Win7

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
val5662
Posts: 34
Joined: 18 Dec 2013 09:48

Batch file problem in Win7

#1 Post by val5662 » 08 Sep 2014 10:51

Hi all....
Using Windows 7 pro.
I have a bat file in a different folder than the trackman.exe I want to start.
Bat file is:

Code: Select all

@echo off
start "" "C:\Sierra\Viper Racing\Data\trackman.exe"
exit /b

When I activate the bat file,I get 2 errors from the program itself ( in german),
and it does not start.
If I put the same bat in the same folder as "trackman.exe" and activate it there , it will start it instantly.
In both cases it will start it,and simultaniously a cmd box appears and dissapears in a millisecond
(that part is ok).
What am I doing wrong
Help please!Thanx!
Val

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: Batch file problem in Win7

#2 Post by Squashman » 08 Sep 2014 12:03

I assume that Trackman.exe is expecting the working directory to be where the executable resides. The working directory will essentially be the directory where the batch file resides. So if the batch file resides in a different folder I would put a PUSHD statement in.

Code: Select all

@echo off
pushd "C:\Sierra\Viper Racing\Data"
start "" "C:\Sierra\Viper Racing\Data\trackman.exe"
exit /b

val5662
Posts: 34
Joined: 18 Dec 2013 09:48

Re: Batch file problem in Win7

#3 Post by val5662 » 08 Sep 2014 13:03

:D Thanks a bunch Squashman!
It worked 100%.
I never heard of the "pushd" thingy before.
Thanks again!
Val

Compo
Posts: 599
Joined: 21 Mar 2014 08:50

Re: Batch file problem in Win7

#4 Post by Compo » 08 Sep 2014 15:44

perhaps this would do the same…

Code: Select all

@PushD C:\Sierra\Viper Racing\Data
@Start trackman

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: Batch file problem in Win7

#5 Post by Squashman » 08 Sep 2014 16:14

Compo wrote:perhaps this would do the same…

Code: Select all

@PushD C:\Sierra\Viper Racing\Data
@Start trackman

Yep

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Batch file problem in Win7

#6 Post by foxidrive » 08 Sep 2014 16:36

This is another way it should work:

Code: Select all

@start "" /D "C:\Sierra\Viper Racing\Data" "trackman.exe"

val5662
Posts: 34
Joined: 18 Dec 2013 09:48

Re: Batch file problem in Win7

#7 Post by val5662 » 08 Sep 2014 19:50

:D Compo and foxidrive....
Thanks to you guys also.Those codes worked great too!
Va.

Post Reply