Reputation: 2948
I found the solution to run an executable file (.bat or .exe) from a local html page in Firefox - it is documented very well here
However, I need to start the executable in the folder where it is located. My executable is a .bat file (D:\Test\file.bat) and it contains the command: echo %cd%
When I run it, it prints:
C:\Programs\FirefoxPortableLegacy36
instead of printing
D:\Test
Is there any way to specify in the htm/javascript where exactly (in which directory) to start my executable?
thanks.
Upvotes: 0
Views: 924
Reputation: 5609
So you want to make the working directory set to the directory where your batch script is? If this is the case then just add this line right in the beginning of your batch script:
pushd "%~dp0"
You can also read the commandline help for the for
command. It explains the parameter replacement well.
Upvotes: 1