If statement 批处理文件以检测文件的存在(确定哪个操作系统并相应地卸载程序)
我试图找出批处理文件的错误,以确定文件夹是否存在,然后在该计算机上为客户端运行正确的卸载 如果机器是x64,则客户端位于一个文件夹中,如果是x86,则位于另一个文件夹中。我不能基于cpu体系结构或winver,因为在我的环境中,除了32位和64位xp之外,我还有32位和64位windows 7 我尝试了以下方法:If statement 批处理文件以检测文件的存在(确定哪个操作系统并相应地卸载程序),if-statement,batch-file,If Statement,Batch File,我试图找出批处理文件的错误,以确定文件夹是否存在,然后在该计算机上为客户端运行正确的卸载 如果机器是x64,则客户端位于一个文件夹中,如果是x86,则位于另一个文件夹中。我不能基于cpu体系结构或winver,因为在我的环境中,除了32位和64位xp之外,我还有32位和64位windows 7 我尝试了以下方法: if exist C:\Windows\ccmsetup GOTO W64 else C:\windows\system32\ccmsetup\ccmsetup.exe /uninst
if exist C:\Windows\ccmsetup GOTO W64
else
C:\windows\system32\ccmsetup\ccmsetup.exe /uninstall
W64
C:\windows\ccmsetup\ccmsetup.exe /uninstall
或
或
这对你来说行吗
IF EXIST C:\Windows\ccmsetup\ccmsetup.exe GOTO W64
IF EXIST C:\windows\system32\ccmsetup\ccmsetup.exe GOTO W32
ECHO Nothing to uninstall
GOTO :EOF
:W32
C:\windows\system32\ccmsetup\ccmsetup.exe /uninstall
GOTO :EOF
:W64
C:\windows\ccmsetup\ccmsetup.exe /uninstall
GOTO :EOF
在脚本的第一行和第二行中,您想要实现什么?
IF EXIST C:\Windows\ccmsetup GOTO W64
IF NOT EXIST C:\Windows\ccmsetup GOTO W32
W32
C:\windows\system32\ccmsetup\ccmsetup.exe /uninstall
W64
C:\windows\ccmsetup\ccmsetup.exe /uninstall
IF EXIST C:\Windows\ccmsetup\ccmsetup.exe GOTO W64
IF EXIST C:\windows\system32\ccmsetup\ccmsetup.exe GOTO W32
ECHO Nothing to uninstall
GOTO :EOF
:W32
C:\windows\system32\ccmsetup\ccmsetup.exe /uninstall
GOTO :EOF
:W64
C:\windows\ccmsetup\ccmsetup.exe /uninstall
GOTO :EOF