hey guys, so i'm a noob to batch scripting and i'm trying to figure out how to write a script for work. basically what i need it to do is run through a loop of IP Addresses.
so for example if the ip list contained 127.1.1.1 and 127.1.1.2.
the script would take 127.1.1.1 and run the command systeminfo[.exe] [/s Computer [/u User [/p Password]]]
it would then have to insert the current ip it's working with into the computer field for that command. the user and password fields are the same for all machines. so the command would look something like this
systeminfo[.exe] [/s 127.1.1.1 [/u User [/p Password]]]
after running that command with the current ip of 127.1.1.1 i'd need it to stick the output to a file, say 127.1.1.1.txt
it would then move on to the next ip in the list, which is 127.1.1.2 and do the same thing.
i don't know if this is even possible but if anybody has suggestions i'd appreciate it! thanks!
help with creating a batch script!!
Moderator: DosItHelp
Re: help with creating a batch script!!
What kind of "IP list" is it? Did you save the IP adresses in a file or come the adresses from another command?
Where do usernames and passwords come from? Or dont you need them?
Regards,
aGerman
Where do usernames and passwords come from? Or dont you need them?
Regards,
aGerman
Re: help with creating a batch script!!
yeah, i have a .txt with a list of ip's in them. and the username and pass would be specified when i actually go to run the script. i just didn't include them in the post. lol
Re: help with creating a batch script!!
Try something like that:
Regards
aGerman
Code: Select all
@echo off &setlocal
set list=IPList.txt
set User=testuser
set Password=testpass
for /f "usebackq" %%a in ("%list%") do (
>>%%a.txt systeminfo /s %%a /u %User% /p %Password%
)
Regards
aGerman
Re: help with creating a batch script!!
great! i can work with that. thanks alot for the quick response and help!