2
我想使用Windows自帶的shell腳本加載該文件:Windows shell腳本到CSV導入到變量
hostname1,host_specific_file1
hostname2,host_specific_file2
hostname3,host_specific_file3
.
.
.
像這樣:
for /f "tokens=1,2* delims=," %%i in (host-info.txt) do set clientName=%%i; set fileLoc=%%j
不工作,但我想它是這樣的:
:loop
For each line, Set the current_hostname=hostnamex and Set the current_file=host_specific_filex
And THEN
DO STUFF
Goto next line, Goto loop
有沒有這樣做的方法?我無法讓我的腳本纏繞在「轉到下一行」或「一次處理一行」的概念上。
謝謝, 克里斯
您是否考慮過使用Powershell?有一個很好的Import-Csv命令,以及一個很好的For-Each-Object命令,可以像這樣循環。 –