我有一个用于蟾蜍自动化的批处理文件。批处理文件应该足够简单,但由于某些原因我不喜欢if语句,我什至尝试了GTR示例,但遗憾的是,在if语句上得到的所有内容都不是语法不正确,也不知道为什么。>
@Echo off
Set _File=ExportDiffFile.csv
Set /a _Lines=0
For /f %%j in ('Find "" /v /c ^< %_File%') Do Set /a _Lines=%%j
REM Echo %_File% has %_Lines% lines.
if "%_Lines%"=="1"(
Echo %_File% has no new lines.
Echo 100.
REM exit 100
)
else
(
Echo %_File% has %_Lines% new lines.
Echo adding into the server.
REM exit 0
)
答案 0 :(得分:0)
似乎我没有正确设置它。
这里应该是这样。如果有人需要,请将问题留在这里。
@Echo off
Set _File=ExportDiffFile.csv
Set /a _Lines=0
For /f %%j in ('Find "" /v /c ^< %_File%') Do Set /a _Lines=%%j
Echo %_File% has %_Lines% lines.
IF "%_Lines%" EQU "1" (
Echo %_File% has no new lines.
Echo 100.
REM exit 100
) ELSE (
Echo %_File% has %_Lines% new lines.
Echo adding into the server.
REM exit 0
)