hi how do I get the dir of the started .bat file in a varaible?
%0 saves the pfad + file name. thx
Dir of .bat file in variable
Moderator: DosItHelp
chill,
If for example your batch file is at c:\dostips\chill\mybatch.cmd then:
set fullname=%~f0
set name=%~n0
set extension=%~x0
set drive=%~d0
set folder=%~p0
set driveAndFolder=%~dp0
will set the variables as follows:
fullname will be: c:\dostips\chill\mybatch.cmd
name will be mybatch
extension will be .cmd
drive will be c:
folder will be \dostips\chill\
driveAndFolder will be c:\dostips\chill\
DosItHelp?
If for example your batch file is at c:\dostips\chill\mybatch.cmd then:
set fullname=%~f0
set name=%~n0
set extension=%~x0
set drive=%~d0
set folder=%~p0
set driveAndFolder=%~dp0
will set the variables as follows:
fullname will be: c:\dostips\chill\mybatch.cmd
name will be mybatch
extension will be .cmd
drive will be c:
folder will be \dostips\chill\
driveAndFolder will be c:\dostips\chill\
DosItHelp?