我在批处理文件中有这个,在Win7和XP上都没有输入到output.txt:
IF EXIST%systemdrive%\ Test.exe(echo success:%systemdrive%\ Test.exe仍然存在)else(echo Bug:%systemdrive%\ Test.exe文件已删除)>> output.txt的
答案 0 :(得分:2)
您似乎正在重定向if的输出,而不是echo的输出。尝试:
IF EXIST %systemdrive%\Test.exe (
echo Success: %systemdrive%\Test.exe still exists >> output.txt
) else (
echo Bug: %systemdrive%\Test.exe file deleted >> output.txt
)
答案 1 :(得分:0)
它应该,我只是运行它,它产生了output.txt。你确定要查看活动目录吗?