Batch file 无论执行什么样的If语句
我试图将文件中由comas分隔的两个字符串与另一个字符串进行比较,如下所示:Batch file 无论执行什么样的If语句,batch-file,Batch File,我试图将文件中由comas分隔的两个字符串与另一个字符串进行比较,如下所示: for /f "tokens=1,2 delims=," %%G in (files.txt) do ( if "%%G"=="copy" do ( copy .\a\something.txt .\b ) 不管我和谁比较,副本都会被执行。在file.txt中,只有两个字符串,如下所示: for /f "tokens=1,2 delims=," %%G in (files.txt
for /f "tokens=1,2 delims=," %%G in (files.txt) do (
if "%%G"=="copy" do (
copy .\a\something.txt .\b
)
不管我和谁比较,副本都会被执行。在file.txt中,只有两个字符串,如下所示:
for /f "tokens=1,2 delims=," %%G in (files.txt) do (
if "%%G"=="copy" do (
copy .\a\something.txt .\b
)
string1.txt,string2.txtIF语句中没有DO。首先将IF语句更改为
if "%%G"=="copy" copy .\a\something.txt .\b