• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

OT - Need help on DOS/NT batch file

Clueless

Senior member
Howdy mates,

From within a batch file, is there a way to find out what the path of that batch file is? It's so easy to do in UNIX but I'm clueless on how to do it on Microsux platforms. Thanks for any help.

Clueless
 
this might help you too


dir|find "Directory of"

That line will output the path.

also this will kinda work, but not if there are any spaces
@ECHO OFF
DIR > }1.BAT
DIR|find "Directory of" > }2.BAT
ECHO SET DRIVE=%%3>VOLUME.BAT
ECHO SET FOLDER=%%2>DIRECTORY.BAT
CALL }1
CALL }2
FOR %%F IN (DIRECTORY.BAT VOLUME.BAT }?.*) DO DEL %%F
ECHO Current drive is %DRIVE%
ECHO Current folder is %FOLDER%
 
Thanks for your help office boy! This is what I finally settled on:

for %%I in (%0) do set EXE_PATH=%%~dpI
echo %EXE_PATH%
 
Back
Top