我有3个不同版本的软件,有3个不同的卸载字符串。我是否可以使用。cmd脚本来识别3个不同的。exe版本来区分它们?
例如:
If exists "c:Program Filesxxxxxxxxxxxxx.exe" and version equals "6.xxx.xx" GOTO Uninstall V6
If exists "c:Program Filesxxxxxxxxxxxxx.exe" and version equals "7.xxx.xx" GOTO Uninstall V7
If exists "c:Program Filesxxxxxxxxxxxxx.exe" and version equals "8.xxx.xx" GOTO Uninstall V8
如果没有,那么我将把集合分成不同的版本,但我想如果可能的话,这可能会更容易。
if exist "AppPath.exe" (
powershell "(Get-Item -path "AppPath.exe").VersionInfo.ProductVersion" | findstr /l "6.0.0.0" >nul & if not errorlevel 1 goto uninistall-v6
powershell "(Get-Item -path "AppPath.exe").VersionInfo.ProductVersion" | findstr /l "7.0.0.0" >nul & if not errorlevel 1 goto uninistall-v7
powershell "(Get-Item -path "AppPath.exe").VersionInfo.ProductVersion" | findstr /l "8.0.0.0" >nul & if not errorlevel 1 goto uninistall-v8
)
echo The program or version was not found