SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2007
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    appending silent switch to the path to uninstall s/w silently using c#

    Hello

    I am appending the silent switch as "/S" to the path as
    "C:\Program Files\DirectoryName\uninstall.exe /S"

    Now this above path I am passing to the one function in executing the process.
    But it is giving me an error as :
    "System cannot find the path specified".

    But, when I run this path from command prompt as:
    C:\Program files\DirectoryName>uninstall.exe /S
    This runs perfectly from the command prompt.

    Now I want to do this using c# winforms.

    The following is my code from where I am executing the process of uninstalling the s/w silently.

    public bool ExecUninstallProcess(string UninstallPath,bool bWaitForExit)
    {
    bool execProcStatus = false;
    Process execProc = new Process();
    execProc.EnableRaisingEvents = false;
    execProc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
    execProc.StartInfo.FileName = UninstallPath;
    bool procStartStatus = execProc.Start();
    if (procStartStatus == true)
    {
    if (bWaitForExit)
    {
    execProc.WaitForExit();
    if (execProc.ExitCode == 0)
    {
    execProcStatus = true;
    }
    else
    execProcStatus = false;
    }
    else
    execProcStatus = true;
    }
    else
    execProcStatus = false;
    where ,
    "UninstallPath " in the above function is the path where I am appending the silent switch as:

    "C:\Program Files\DirectoryName\uninstall.exe /S"

    and

    "bwaitforExit" is defined as "true"

    So, please anybody can tell me how to do this in c#

    Thanx in advance

  2. #2
    SitePoint Member
    Join Date
    Sep 2007
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my problem is solved


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •