[英]windows batch read file and run command
我需要Windows批處理腳本的幫助。
我想讓批處理文件讀取文本文件nodes.txt
中的主機名列表,然后為nodes.txt
找到的每個主機名運行以下命令
這是要運行的命令
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
-host
腳本之后應放置主機名,例如
ovdeploy -upload -file "C:\Users\AG\scopemsgs" -targetdir "c:\temp" -host node123.com
我試過了
for /f %%i in (nodes.txt) do set node=%%i
ovdeploy -upload -file "C:\Users\AG\scopemsgs" -targetdir "c:\temp" -host node
for /f %%i in (nodes.txt) do (
ovdeploy ... -host %%i
ovdeploy ... -host %%i
ovdeploy ... -host %%i
)
將依次為%%i
分配文件中找到的每個值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.