PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET not able to run the Process

Reply

not able to run the Process

 
Thread Tools Rate Thread
Old 24-08-2006, 08:38 AM   #1
Lucky
Guest
 
Posts: n/a
Default not able to run the Process


Hi guys,
it's me again. today i'm trying the "Process" class.
I'm trying to uninstall one product developed by my company thorugh
..net code but it seems not working but when i execute the commandline
MSI uninstall command it seems working fine. the code i'm using is:

System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.CreateNoWindow = true;
p.StartInfo.FileName =
Path.GetFullPath(System.Environment.GetEnvironmentVariable("WINDIR") +
"/system32/msiexec.exe");//Environment.GetEnvironmentVariable("WINDIR")+
"/system32/msiexec.exe";
p.StartInfo.Arguments = "/uninstall " + new
FileInfo(powerlearn.MSIPath).Name + " /qn";
p.Start();
p.WaitForExit();


whenever i execute the code, it does nothing. i mean i tried to debug
this code but when i came to "p.WaitForExit();" and i pressed the F10
it moved to another line without waiting process to be completed. seems
that process is somehow not able to run.

can anyone help me out from this problem? any other solution is also
welcome.

Tools:
c#.net 2.0 (VS.NET 2005)


Thanks,
Lucky

  Reply With Quote
Old 24-08-2006, 08:49 AM   #2
Lucky
Guest
 
Posts: n/a
Default Re: not able to run the Process

I forgot to add some information.

when i start the process it exits in a second and returns ExitCode :
1619

i hope it would help more.

thanks again,
Lucky

  Reply With Quote
Old 24-08-2006, 09:30 AM   #3
Lucky
Guest
 
Posts: n/a
Default Re: not able to run the Process

Hi guys,

it's again me. i found the solution of my problem.
there are to ways to do it.

1) in the Arguments pass the fullname of the FileInfo object rather
then only file name
2) keep the code as it is and change the directory to file directory
where the file is, before this code.

it is all about telling msi the full path of the s/w msi file. it
doesnt matter wihch way u do it. you only needs to tell it where is
that file.

by the way. thanks for reading.

Lucky

  Reply With Quote
Old 25-08-2006, 04:44 AM   #4
GhostInAK
Guest
 
Posts: n/a
Default Re: not able to run the Process

Hello Lucky,

Actually, it does matter how you do it. Unless you set the working directory
back after you are done.. things may not work as expected. Given a choice,
you should always opt to pass the full path rather than change the working
directory.

-Boo

> Hi guys,
>
> it's again me. i found the solution of my problem. there are to ways
> to do it.
>
> 1) in the Arguments pass the fullname of the FileInfo object rather
> then only file name
> 2) keep the code as it is and change the directory to file directory
> where the file is, before this code.
> it is all about telling msi the full path of the s/w msi file. it
> doesnt matter wihch way u do it. you only needs to tell it where is
> that file.
>
> by the way. thanks for reading.
>
> Lucky
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off