hello
i have ascript with this
SET SUBDIR=%~dp0
SET DRIVE=%cd:~0,3%
can anyone tell me the signification of the values assigned to the variable...thanks in advance
variable dos ~dp0
Moderator: DosItHelp
Re: variable dos ~dp0
if the batch file is located at c:\files\batch\myfile.bat
then this will set subdir to c:\files\batch\
SET SUBDIR=%~dp0
This will take what is printed when you type ECHO %CD%
and will set DRIVE to the first three characters. (skip 0, take 3)
SET DRIVE=%cd:~0,3%
Try this:
@echo off
echo SET SUBDIR=%~dp0
echo SET DRIVE=%cd:~0,3%
pause
then this will set subdir to c:\files\batch\
SET SUBDIR=%~dp0
This will take what is printed when you type ECHO %CD%
and will set DRIVE to the first three characters. (skip 0, take 3)
SET DRIVE=%cd:~0,3%
Try this:
@echo off
echo SET SUBDIR=%~dp0
echo SET DRIVE=%cd:~0,3%
pause