我需要从所有分支计算机(32位和64位)中删除程序,并使用所有计算机的注册表修复程序重新安装和更新软件版本。似乎并不困难,但我试图使用批处理文件(可能最简单)来做到这一点,我坚持检查操作系统版本部分。
我可以得到一些帮助吗?这是批次; 几个指针;代码:
echo off
:CheckOS (this part not done)
IF EXIST "%PROGRAMFILES(X86)%" (GOTO disconnect) ELSE (GOTO Fincentric check)
if exist r:\ goto disconnect
:disconnect
net use r: /d
net use r: \\a0363sfp06\rfsnt
pause
:check
if exist c:\%programfiles%\Fincentric\CAMNet goto remove01 else
if exist c:\%programfiles%\Fincentric\BridgeNET v2.3.0 goto remove02 else
if exist c:\%programfiles%\Fincentric\CAMPlugins goto remove03 else
if exist c:\%programfiles%\Fincentric\Canvas goto remove04 else
if exist c:\%programfiles%\Fincentric\Platform goto remove05 else
if exist c:\%programfiles%\Fincentric\SupportLibraries goto remove06 else
:remove01
start /wait msiexec /quiet /qr /uninstall R:\WBDK\WBCAMNet_CGI.msi
if %ERRORLEVEL% EQU 1721 (
echo Failure Reason Given is %errorlevel%
exit /b %errorlevel%
)
:remove02
start /wait msiexec /quiet /qr /uninstall R:\WBDK\WBBridgeNET.msi
if %ERRORLEVEL% EQU 1721 (
echo Failure Reason Given is %errorlevel%
exit /b %errorlevel%
)
:remove03
start /wait msiexec /quiet /qr /uninstall R:\WBDK\WBCAMPlugins.msi
if %ERRORLEVEL% EQU 1721 (
echo Failure Reason Given is %errorlevel%
exit /b %errorlevel%
)
:remove04
start /wait msiexec /quiet /qr /uninstall R:\WBDK\WBCanvas.msi
if %ERRORLEVEL% EQU 1721 (
echo Failure Reason Given is %errorlevel%
exit /b %errorlevel%
)
:remove05
start /wait msiexec /quiet /qr /uninstall R:\WBDK\WBPlatform.msi
if %ERRORLEVEL% EQU 1721 (
echo Failure Reason Given is %errorlevel%
exit /b %errorlevel%
)
:remove06
start /wait msiexec /quiet /qr /uninstall R:\WBDK\WBSupportLibraries.msi
if %ERRORLEVEL% EQU 1721 (
echo Failure Reason Given is %errorlevel%
exit /b %errorlevel%
)
:Fincentric check
cls
echo Checking if Fincentric folder still exist....
if exist c:\%PROGRAMFILES(X86)%\Fincentric
TIMEOUT /T 3 /NOBREAK
del /S /Q "c:\Program Files"\fincentric goto alldone
pause
:alldone
echo WDBK 5 has been remove...
TIMEOUT /T 1
exit
rem :remove07
rem :remove
rem :remove
答案 0 :(得分:1)
问题不在:CheckOS
部分,而在:Fincentric check
部分。
if
语句不完整,但有一些错误。这一行:
if exist c:\%PROGRAMFILES(X86)%\Fincentric
将扩展为
if exist c:\C:\ProgramFiles (x86)\Fincentric
删除前导c:
并将路径名放在引号中,以确保它没有空格问题。它应该是这样的:
if exist "%PROGRAMFILES(X86)%\Fincentric" (
echo do stuff
echo do more stuff
)
您的路径周围的引号不正确也是您与del
行相同问题的一部分。另一部分是你在两个命令之间缺少连接符号&
(&符号):
del /S /Q "c:\Program Files\fincentric" & goto alldone
此外,部分标签最多只能识别一个空格,因此:Fincentric check
实际上只被识别为:Fincentric
。这看起来并不像你当前给你带来任何麻烦,但在某些情况下可能会出现这种情况。为了安全起见,我重命名并删除空格(行:Fincentric_Check
或:FincentricCheck
)