Quizzes & Puzzles0 min ago
Windows Batch Scripting HELP
2 Answers
Hiya :) i was just wondering if theres someone with good knowledge of windows batch out there, whos willing to help me?
For university iv been required to create a windows batch script which will help an admin. So far I’ve done add/remove/edit user, backup, system info etc however my tutor has advised me to create a FOR loop on add user to make it more advanced. Atm the admin has to manually enter each user name and password however i want to run a loop which will read an existing text file and automatically create the accounts.
I understand that the structure of a loop is FOR %A IN (list) DO command [ parameters ]( http://www.robvanderwoude.com/for.php) and so far i have come up with “for %%a in (users.txt) do [net user /add]” something such as this but obviously its not working.
Do i have to declare users.txt and insert it between net user and /add? Or is this completely wrong? Iv been trying to figure this out for days and there isn’t much material to go on. Thanks in advanced for any advice and guidences given, its much appreciated!
For university iv been required to create a windows batch script which will help an admin. So far I’ve done add/remove/edit user, backup, system info etc however my tutor has advised me to create a FOR loop on add user to make it more advanced. Atm the admin has to manually enter each user name and password however i want to run a loop which will read an existing text file and automatically create the accounts.
I understand that the structure of a loop is FOR %A IN (list) DO command [ parameters ]( http://www.robvanderwoude.com/for.php) and so far i have come up with “for %%a in (users.txt) do [net user /add]” something such as this but obviously its not working.
Do i have to declare users.txt and insert it between net user and /add? Or is this completely wrong? Iv been trying to figure this out for days and there isn’t much material to go on. Thanks in advanced for any advice and guidences given, its much appreciated!
Answers
You need to pass the for variable to the net user command.
FOR %%a IN (users.txt) DO net user %%a /ADD
13:02 Mon 28th Nov 2011
Related Questions
Sorry, we can't find any related questions. Try using the search bar at the top of the page to search for some keywords, or choose a topic and submit your own question.