Is there Uninstall a program batch for windows?

前端 未结 5 794
-上瘾入骨i
-上瘾入骨i 2020-12-05 01:17

I have several programs I want to uninstall from my computer (Windows 7 64bit).

Is there a batch\\script that can help me do it? or I need to do it one by one from C

5条回答
  •  温柔的废话
    2020-12-05 01:51

    I wrote this this morning.

    @Echo off
    Echo This is a batch file uninstallation program. 
    Echo Run as administrator WMIC will not work. 
    echo.
    Echo The command [wmic product get name] will run.
    Echo Looking up all installed programs...
    echo. 
    wmic product get name
    
     echo 1. First program
     echo 2. Second program
     echo 3. Third program
     echo 4. Fourth program
     echo 5. Fifth program
    echo.
    @echo Pick a number: 
    echo. 
     choice /c:12345 
    
     if "%errorlevel%"=="1" wmic product where name="First program" call uninstall
     if "%errorlevel%"=="2" wmic product where name="Second program" call uninstall
     if "%errorlevel%"=="3" wmic product where name="Third program" call uninstall
     if "%errorlevel%"=="4" wmic product where name="Fourth program" call uninstall
     if "%errorlevel%"=="5" wmic product where name="Fifth program" call uninstall
    
    Echo.
    Echo.
    
    @echo First method is done. I'll go into the alternate method. 
    
    pause
    Echo Get user input - program name?
    Echo.
    Echo This is an alternate method 
    :input
    set INPUT=
    set /P INPUT=Uninstall which program?: %=%
    if "%INPUT%"=="" goto input
    echo Your input was: %INPUT%
    
    echo.
    echo.
    Echo Uninstalling... 
    
    echo The command [wmic product where name="%INPUT%" call uninstall] will run. 
    
    
    wmic product where name="%INPUT%" call uninstall
    
    @echo If there is "no instance" errors, then the program %INPUT% was uninstalled.
    
    pause
    

提交回复
热议问题