Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
Rileyh
- Posts: 147
- Joined: 01 Sep 2011 03:54
- Location: Perth, Western Australia
#1
Post
by Rileyh » 19 Oct 2011 00:23
I am hoping that someone could tell me how to do the following.
I would like to make a batch file where someone has to set up an "account". But then once they have made their "account", the batch file places
Code: Select all
chdir /D (whatever the directory they have made their account in)
into the very start of the batch file's code so that it can go straight to the "login" part instead of following the "setup" path.
Any help would be appreciated,
Rileyh
-
aGerman
- Expert
- Posts: 4705
- Joined: 22 Jan 2010 18:01
- Location: Germany
#2
Post
by aGerman » 28 Oct 2011 10:36
What is this good for? Just pass the new path as parameter and find it as %1.
bat1.bat
Code: Select all
@echo off
echo this is bat1
call "bat2.bat" "C:\Windows"
echo this is bat1 again
pause
bat2.bat
Code: Select all
@echo off
echo this is bat2
echo current directory is "%cd%"
if exist "%~1" cd /d "%~1"
echo new directory is "%cd%"
:: your stuff here
Regards
aGerman