Batch file help... determine drive it is run from

This problem is very trivial, but I have been searching all over the place and haven't found an answer. I have a batch file that works on its own. My installer has to call use batch code rather than calling the external batch file, which looks like: START directory\directory\directory\program.

Windows Software 5498 This topic was started by ,


data/avatar/default/avatar04.webp

1 Posts
Location -
Joined 2005-01-12
This problem is very trivial, but I have been searching all over the place and haven't found an answer.
 
I have a batch file that works on its own. My installer has to call use batch code rather than calling the external batch file, which looks like:
 
START directory\directory\directory\program.exe -param -param param_directory\param_jarfile.jar
 
This code works fine from the batch.bat file, but from the installer I get an error that the executable cannot be found.
 
How can I determine the drive the batch file was run from? Given the drive letter I should be able to build the string necessary for the START command to open the file.
 

Participate on our website and join the conversation

You have already an account on our website? Use the link below to login.
Login
Create a new user account. Registration is free and takes only a few seconds.
Register
This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


data/avatar/default/avatar04.webp

352 Posts
Location -
Joined 2003-03-28
well, you can do a CD command that lists the current directory. Redirect that to a text file, then do a FOR loop to extract the c:\ portion.
 
Been using batch files since '83.