I know I can do this with Powershell but, well, more as a project to practice my Command Prompt Scripting skills, wanna do it with a batch file. I have a txt file with ComputerNames, I want my loop to echo the name, then run SystemInfo and grab a particular line from the result.
Computers.txt reads like this:
XPCOMPUTER1
XPCOMPUTER2
W7COMPUTER1
W7COMPUTER2
My batch file looks like this:
For /F %%w IN (computer.txt) Do (echo %%w & psexec \\%%w cmd.exe &
systeminfo | Find "Total Physical Memory:")
Which, should, list the host name, then PSexec into it and run SystemInfo and grab the Total Physical Memory, right? I thought so! But I get
%%W was unexpected at this time.
Any thoughts?