Finding the path to the running executable

Started by NickL, January 09, 2014, 01:43:20 AM

Previous topic - Next topic

NickL

Hi.

I'm running a compiled WinBatch script on a server share and I need to call another executable in the same folder - however the folder name is not static and can change, so what I'm after is a command or function that tells me the path that the currently running script has been run from.

I've looked through the functions manual but can't find anything that does this.

Any help would be much appreciated.

snowsnowsnow

Have you tried IntControll(1004)?  I think (but am not sure) that if you are running as compiled EXE, that will give you the full path to your EXE.

Alternatively, you can use WMI and the Win32 Process class to get the "Name" attribute of any process.

NickL

IntControl(1004,0,0,0,0)  works a treat - that's exactly what I was after.  Thanks very much :-)

Deana

Quote from: NickL on January 09, 2014, 01:43:20 AM
Hi.

I'm running a compiled WinBatch script on a server share and I need to call another executable in the same folder - however the folder name is not static and can change, so what I'm after is a command or function that tells me the path that the currently running script has been run from.

I've looked through the functions manual but can't find anything that does this.

Any help would be much appreciated.

The best function to use to obtain the directory the script is running from is DirScript().
Deana F.
Technical Support
Wilson WindowWare Inc.