Computer Hope
Microsoft => Microsoft DOS => Topic started by: lionround on October 30, 2015, 09:55:54 AM
-
I am trying to create a directory based on three variables. Then I use the "civmd.bat" file to create subdirectories under that in a standardized format.
@ECHO OFF
SET /P uname=Please enter your name:
IF "%uname%"=="" GOTO Error
SET /P uname2=Please enter Defendant's Last name:
SET /P caseno=Please enter USA Case Number:
ECHO Hello %uname%, Welcome to DOS inputs!
MD "D:\%uname%\%uname2% %caseno%"
copy d:\civmd.bat "D:\%uname%\%uname2% %caseno%"
cd "D:\%uname%\%uname2% %caseno%"
call "D:\%uname%\%uname2% %caseno%\civmd.bat"
PAUSE
GOTO End
:Error
ECHO You did not enter your name! Bye bye!!
:End
Everything works as planned except that the civmd.bat file that is being "called" runs in whatever directory I have this input.bat file. Not in the "D:\%uname%\%uname2% %caseno%" directory.
-
Is the input.bat stored in a folder on the D drive? The reason I ask is that a CD command will not work if the new directory is on a different drive form the current folder unless you use the /D switch to change the drive, e.g.
cd /d "D:\%uname%\%uname2% %caseno%"
Or you can change the drive first:
D:
cd /d "D:\%uname%\%uname2% %caseno%"
-
No, it wasn't. It was on my c:\temp. I took it from your question that would matter, so I moved it and it worked.