Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Creating batch file to install/uninstall C# app

Creating batch file to install/uninstall C# app

Scheduled Pinned Locked Moved C#
csharpquestionworkspacedotnetxml
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    steve_rm
    wrote on last edited by
    #1

    Hello, I am using the following bat file to install my application on a user computer. However, the client want to be able uninstall the application if the application is installed, and then install the new version of the application. However, I have 2 problems. 1) how can I detect if the application is installed or not? 2) If it is installed, how can I uninstall it? The application is a C# 2005. Many thanks for any advice,

    @ECHO OFF
    :: Copy the configuration file
    copy config.xml "%AppData%\DataLinks.xml"

    :: Search for the CONFIG file, if this doesn't exit then the user doesn't have the .Net framework 2.0
    SET FileName=%windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG
    IF EXIST %FileName% GOTO INSTALL_DIALER
    ECHO.You currently do not have the Microsoft(c) .NET Framework 2.0 installed.
    ECHO.This is required by the setup program for CAT Dialer
    ECHO.
    ECHO.The Microsoft(c) .NET Framework 2.0 will now be installed on you system.
    ECHO.After completion setup will continue to install CAT Dialer on your system.
    ECHO.
    :: Install the .Net framework and then run setup to install the CAT Dialerr
    PAUSE
    ECHO Installing... this could take serveral minutes...Please wait....
    START /WAIT NetFx20SP2_x86.exe
    :: If the user cancels the installation of the framework exit batch file
    IF errorlevel 1 GOTO EOF
    Start CATSoftphone.exe
    ECHO ON
    EXIT

    :: .Net framework has been skipped contine to install the dialer.
    :INSTALL_DIALER
    ECHO *** Skiped Dotnet Framework 2.0.50727 ***
    ECHO Installing... Please wait...
    START CATSoftphone.exe
    ECHO ON
    EXIT

    A 1 Reply Last reply
    0
    • S steve_rm

      Hello, I am using the following bat file to install my application on a user computer. However, the client want to be able uninstall the application if the application is installed, and then install the new version of the application. However, I have 2 problems. 1) how can I detect if the application is installed or not? 2) If it is installed, how can I uninstall it? The application is a C# 2005. Many thanks for any advice,

      @ECHO OFF
      :: Copy the configuration file
      copy config.xml "%AppData%\DataLinks.xml"

      :: Search for the CONFIG file, if this doesn't exit then the user doesn't have the .Net framework 2.0
      SET FileName=%windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG
      IF EXIST %FileName% GOTO INSTALL_DIALER
      ECHO.You currently do not have the Microsoft(c) .NET Framework 2.0 installed.
      ECHO.This is required by the setup program for CAT Dialer
      ECHO.
      ECHO.The Microsoft(c) .NET Framework 2.0 will now be installed on you system.
      ECHO.After completion setup will continue to install CAT Dialer on your system.
      ECHO.
      :: Install the .Net framework and then run setup to install the CAT Dialerr
      PAUSE
      ECHO Installing... this could take serveral minutes...Please wait....
      START /WAIT NetFx20SP2_x86.exe
      :: If the user cancels the installation of the framework exit batch file
      IF errorlevel 1 GOTO EOF
      Start CATSoftphone.exe
      ECHO ON
      EXIT

      :: .Net framework has been skipped contine to install the dialer.
      :INSTALL_DIALER
      ECHO *** Skiped Dotnet Framework 2.0.50727 ***
      ECHO Installing... Please wait...
      START CATSoftphone.exe
      ECHO ON
      EXIT

      A Offline
      A Offline
      Arindam Sinha
      wrote on last edited by
      #2

      I am not very sure why you are trying to install through the batch file. You can very much use a setup project to accomplish this. If you have it installed already, then it wil prompt you. Anyway, please find the details of Seup Project[^]. If you ask my opinion, I would suggest you to try ClickOnce[^] installation which has many advantanges over MSI installation.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups