Batch file 卸载批处理文件不工作关闭
有下面的文件 我的最终目标是检查目录中的文件,如果该文件存在,请不要执行任何操作 如果文件不存在,请在该电脑上卸载teamviewer 下面是脚本Batch file 卸载批处理文件不工作关闭,batch-file,if-statement,command-prompt,Batch File,If Statement,Command Prompt,有下面的文件 我的最终目标是检查目录中的文件,如果该文件存在,请不要执行任何操作 如果文件不存在,请在该电脑上卸载teamviewer 下面是脚本 IF EXIST C:\store\TV-DONOTDELETE.TXT (echo Found the file won't do anything.) pause ELSE ( REM Kill TeamViewer Process taskkill /f /im teamviewer* REM Remove Older Versions f
IF EXIST C:\store\TV-DONOTDELETE.TXT
(echo Found the file won't do anything.)
pause
ELSE
(
REM Kill TeamViewer Process
taskkill /f /im teamviewer*
REM Remove Older Versions
for /d %%F in ("C:\Program Files\TeamViewer\*") do "%%F\uninstall.exe" /S
for /d %%F in ("C:\Program Files (x86)\TeamViewer\*") do "%%F\uninstall.exe" /S
REM Remove Newer Versions
"C:\Program Files\TeamViewer\uninstall.exe" /S
"C:\Program Files (x86)\TeamViewer\uninstall.exe" /S
echo removed teamviewer you can thank me later
)
pause
谢谢大家的帮助,这是你们推荐的所有研究的最终结果
@echo off
CD C:\store\
if exist "TV-DONOTDELETE.TXT" (
echo "Found the file won't do anything."
pause
) ELSE (
REM Kill TeamViewer Process
taskkill /f /im teamviewer*
REM Remove Older Versions
for /d %%F in ("C:\Program Files\TeamViewer\*") do "%%F\uninstall.exe" /S
for /d %%F in ("C:\Program Files (x86)\TeamViewer\*") do "%%F\uninstall.exe" /S
REM Remove Newer Versions
"C:\Program Files\TeamViewer\uninstall.exe" /S
"C:\Program Files (x86)\TeamViewer\uninstall.exe" /S
echo "Removed teamviewer"
md c:\store
CD c:\store\
type nul >TV-DONOTDELETE.txt
echo "Created the file, now you can thank me later"
pause
)
IF命令帮助文件实际上有一个使用IF-EXIST-ELSE的示例。很明显,您没有阅读帮助文件。既然您能够在问题中正确地标记代码,为什么不在答案上加上标记?