我当前的 .bat 文件如下:
@echo off
rem iTunes
tasklist /FI "IMAGENAME eq itunes.exe" /FO CSV > "C:/ForStartingStuff/ForItunes.log"
FOR /F %%A IN (' "C:/ForStartingStuff/ForItunes.log" ') DO IF %%~zA EQU 0 GOTO end
cd "C:\Program Files (x86)\iTunes"
:end
taskkill /im notepad.exe
del "C:/ForStartingStuff/ForItunes.log
rem WC3 Banlist
tasklist /FI "IMAGENAME eq WC3Banlist.exe" /FO CSV > "C:/ForStartingStuff/ForWC3Blist.log"
FOR /F %%A IN (' "C:/ForStartingStuff/ForWC3Blist.log" ') DO IF %%~zA EQU 0 GOTO end
cd "C:\Program Files (x86)\WC3Banlist"
start WC3Banlist.exe
:end
del "C:/ForStartingStuff/ForItunes.log
rem Warcraft3
tasklist /FI "IMAGENAME eq wc3.exe" /FO CSV > "C:/ForStartingStuff/ForWarcraft.log"
FOR /F %%A IN (' "C:/ForStartingStuff/ForWarcraft.log" ') DO IF %%~zA EQU 0 GOTO end
cd "C:\Program Files (x86)\Warcraft III"
start war3.exe
:end
exit
我的目标是只有在程序还没有打开的情况下才能打开程序。这很好用,但一个问题是我必须手动关闭打开的记事本窗口以读取 For****.log 文件。有没有办法让这些东西自动关闭?顺便说一句,我正在运行 vista。