Create a loop in a batch file
source link: https://www.codesd.com/item/create-a-loop-in-a-batch-file.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Create a loop in a batch file
I need a batch file where a user enters a password and if it is correct it maps a drive. If it is wrong then it needs to go back to the start
I have this
:start
echo Username=****
SET /P password=Please enter the password
IF %password%==password goto map
IF %password%!==!password goto start
:map
NET USE Z: \\server\folder
It works if the password entered is correct, but doesnt if it is wrong
Any help?
You don't need IF %password%!==!password goto start
altogether. If the password is ok, then goto map
, otherwise goto start
. That is if you replace IF %password%!==!password goto start
with goto start
you'll get what you want.
Related Articles
Define the iMacros loop in the batch file
How do you create a journal using a batch file?
For a loop in a batch file reading a File Paths file
How to use FOR loops embedded in batch files
How to end a VBS file called from a batch file and loop through the batch file
Create an event with the batch files
How to set a timestamp when copying files in the for loop to the batch file
How to divide the string without the for loop in the batch file
Django creates a superuser from a batch file
How can I use special characters to create a folder in a batch file?
How to create a MAP reader by batch file
Unable to create zip using 7z in batch file
copy all items from one folder to another folder using a loop in a batch file
How to create a script via a batch file that will uninstall a program if it was installed on Windows 7 64-bit or 32-bit
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK