Should be pretty easy right.. I am battling this. Or rather it battles me. So I do:
net use w: /delete
SET SERVER1=myserver
SET ROOT_DRIVE=c$
SET WEB_ROOT=\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\
SET DESTINATION_FOLDER=PPA20_TEST
net use w: \\%SERVER1%\%ROOT_DRIVE% /User:%usern% %password% /persistent:yes
cd w:%WEB_ROOT%
md %DESTINATION_FOLDER%
So supposedly this should create my DESTINATION_FOLDER inside WEB_ROOT folder under the mapped drive. Instead it creates it where that batch file is called from..
It’s because it doesn’t change the active drive, it merely changes the active directory on the drive
W:.To change both the active drive and the active directory, use the
/Dswitch:However, you may not really need to set the
w:%WEB_ROOT%directory active. Just specify the full path in themdcommand: