【发布时间】:2016-05-30 15:06:32
【问题描述】:
我创建了一个批处理文件来运行test并运行test1如果它还没有运行
但是当我运行它时
@echo off
start test.exe >nul 2>nul
tasklist /fi "IMAGENAME eq test1.exe">tmp.t
set /p "isRunning=<tmp.t"
%isRunning%>test1.txt
pause
IF NOT /i %isRunning:INFO=%==%isRunning% (start X:\X\test1.exe >nul 2>nul)
timeout 10
del tmp.t
它说
'INFO:' Is not regonized as an internal or external command,operable program
or batch file
然后
:was unexpected at the time
test1.txt 也是空的。这条线IF NOT /i %isRunning:~INFO=%==%isRunning% 被要求检查进程是否正在运行。它似乎
像字符串替换没有按应有的方式工作%isRunning:INFO=%
我不知道出了什么问题。
【问题讨论】:
标签: batch-file