|
Answer» I have a list of hostnames in a TEXT file nodes.txt that I want batch file to read then run following commands for each hostname found in nodes.txt
Here are the commands to run
ovdeploy -upload -file "C:\Users\AG\scopemsgs" -targetdir "c:\temp" -host ovdeploy -cmd "move c:\temp\scopemsgs 'C:\Program Files\HP\HP BTO Software\msg\C\'" -host ovdeploy -cmd "ovpacmd start" -host ovdeploy -cmd "perfstat -p" -host
after -host SCRIPT should put hostname from the node.txt file. for example
ovdeploy -upload -file "C:\Users\AG\scopemsgs" -targetdir "c:\temp" -host node123.com
I tried this
for /f %%i in (nodes.txt) do set node=%%i
ovdeploy -upload -file "C:\Users\AG\scopemsgs" -targetdir "c:\temp" -host node Almost got it right, try: CODE: [Select]for /f %%i in (nodes.txt) do ovdeploy -upload -file "C:\Users\AG\scopemsgs" -targetdir "c:\temp" -host %%i
Also, don't FORGET that variables in batch must be surrounded by % symbles, or ! if setlocal EnableDelayedExpansion is used.This is what I interpret that you need to do: Each line in nodes.txt has a SINGLE host on it.
Code: [Select]@echo off for /f "delims=" %%a in (nodes.txt) do ( ovdeploy -upload -file "C:\Users\AG\scopemsgs" -targetdir "c:\temp" -host %%a ovdeploy -cmd "move c:\temp\scopemsgs 'C:\Program Files\HP\HP BTO Software\msg\C\'" -host %%a ovdeploy -cmd "ovpacmd start" -host %%a ovdeploy -cmd "perfstat -p" -host %%a )
|