Any way I can launch origram with parameter

G

Guest

I used System.Diagnostics.Process.Start(str) to launch application.
str is based on the registry setting, in registry, it might be
str = rundll32.exe "%ProgramFiles%\INTERN~1\hmmapi.dll",OpenInboxHandler
str = "C:\PROGRA~1\MICROS~4\OFFICE11\OUTLOOK.EXE" /recycle
str = "C:\Program Files\Internet Explorer\iexplore.exe" -nohome

System.Diagnostics.Process.Start(str) can't launch with parameter, and there
might be any kind of the parameter in registry with exe file, what should I
do?
 
P

Peter Jausovec

Hi,

I think you should use
System.Diagnostics.ProcessStartInfo pStartInfo = new
System.Diagnostics.ProcessStartInfo ("filename", "parameters");
and then use Process.Start (pStartInfo) to start the process.

Hope that helps.
 
M

Mike Newton

Steve said:
I used System.Diagnostics.Process.Start(str) to launch application.
str is based on the registry setting, in registry, it might be
str = rundll32.exe "%ProgramFiles%\INTERN~1\hmmapi.dll",OpenInboxHandler
str = "C:\PROGRA~1\MICROS~4\OFFICE11\OUTLOOK.EXE" /recycle
str = "C:\Program Files\Internet Explorer\iexplore.exe" -nohome

System.Diagnostics.Process.Start(str) can't launch with parameter, and there
might be any kind of the parameter in registry with exe file, what should I
do?

Check out the ProcessStartInfo class. I usually run external processes
by building one of those objects first.
 
G

Guest

For str is get from registry, str parameter might be all kind of express
str = rundll32.exe "%ProgramFiles%\INTERN~1\hmmapi.dll",OpenInboxHandler
str = "C:\PROGRA~1\MICROS~4\OFFICE11\OUTLOOK.EXE" /recycle
str = "C:\Program Files\Internet Explorer\iexplore.exe" -nohome
how can I extract parameter correctly?
If used split "-" "," "/"
str might have "-" "," "/" elsewhere other than parameter
 
P

Peter Jausovec

Hi,

Maybe you should use a set of delimiters (-,/,\, ...), split the str and get
the last item in array. e.g.: str = "c:\programs\someexe.exe /param1";

string [] sParams = str.Split ('/');

then the parameter will be in sParams[sParams.Length-1];

Of course that would be ok for just one parameter ...
 
G

Guest

if
str = "C:\Program Files\Internet-Explorer\iexplore.exe" -nohome
have two "-" on the string and -nohome is parameter,
Can I get right parameter with split?
I will try later, thanks a lot
Peter Jausovec said:
Hi,

Maybe you should use a set of delimiters (-,/,\, ...), split the str and get
the last item in array. e.g.: str = "c:\programs\someexe.exe /param1";

string [] sParams = str.Split ('/');

then the parameter will be in sParams[sParams.Length-1];

Of course that would be ok for just one parameter ...
--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
Steve said:
For str is get from registry, str parameter might be all kind of express
str = rundll32.exe "%ProgramFiles%\INTERN~1\hmmapi.dll",OpenInboxHandler
str = "C:\PROGRA~1\MICROS~4\OFFICE11\OUTLOOK.EXE" /recycle
str = "C:\Program Files\Internet Explorer\iexplore.exe" -nohome
how can I extract parameter correctly?
If used split "-" "," "/"
str might have "-" "," "/" elsewhere other than parameter
 
P

Peter Jausovec

if you split this str = "C:\Program
Files\Internet-Explorer\iexplore.exe -nohome" you will get an string array
with 3 elements:

C:\Program Files\Internet
Explorer\iexplore.exe
nohome

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
Steve said:
if
str = "C:\Program Files\Internet-Explorer\iexplore.exe" -nohome
have two "-" on the string and -nohome is parameter,
Can I get right parameter with split?
I will try later, thanks a lot
Peter Jausovec said:
Hi,

Maybe you should use a set of delimiters (-,/,\, ...), split the str and
get
the last item in array. e.g.: str = "c:\programs\someexe.exe /param1";

string [] sParams = str.Split ('/');

then the parameter will be in sParams[sParams.Length-1];

Of course that would be ok for just one parameter ...
--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
Steve said:
For str is get from registry, str parameter might be all kind of
express
str = rundll32.exe
"%ProgramFiles%\INTERN~1\hmmapi.dll",OpenInboxHandler
str = "C:\PROGRA~1\MICROS~4\OFFICE11\OUTLOOK.EXE" /recycle
str = "C:\Program Files\Internet Explorer\iexplore.exe" -nohome
how can I extract parameter correctly?
If used split "-" "," "/"
str might have "-" "," "/" elsewhere other than parameter




:

Hi,

I think you should use
System.Diagnostics.ProcessStartInfo pStartInfo = new
System.Diagnostics.ProcessStartInfo ("filename", "parameters");
and then use Process.Start (pStartInfo) to start the process.

Hope that helps.

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"Steve" <[email protected]> je napisal v sporoeilo
...
I used System.Diagnostics.Process.Start(str) to launch application.
str is based on the registry setting, in registry, it might be
str = rundll32.exe
"%ProgramFiles%\INTERN~1\hmmapi.dll",OpenInboxHandler
str = "C:\PROGRA~1\MICROS~4\OFFICE11\OUTLOOK.EXE" /recycle
str = "C:\Program Files\Internet Explorer\iexplore.exe" -nohome

System.Diagnostics.Process.Start(str) can't launch with parameter,
and
there
might be any kind of the parameter in registry with exe file, what
should
I
do?
 
G

Guest

Peter,

Thanks a lot for your help.

Peter Jausovec said:
if you split this str = "C:\Program
Files\Internet-Explorer\iexplore.exe -nohome" you will get an string array
with 3 elements:

C:\Program Files\Internet
Explorer\iexplore.exe
nohome

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
Steve said:
if
str = "C:\Program Files\Internet-Explorer\iexplore.exe" -nohome
have two "-" on the string and -nohome is parameter,
Can I get right parameter with split?
I will try later, thanks a lot
Peter Jausovec said:
Hi,

Maybe you should use a set of delimiters (-,/,\, ...), split the str and
get
the last item in array. e.g.: str = "c:\programs\someexe.exe /param1";

string [] sParams = str.Split ('/');

then the parameter will be in sParams[sParams.Length-1];

Of course that would be ok for just one parameter ...
--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"Steve" <[email protected]> je napisal v sporoeilo
...
For str is get from registry, str parameter might be all kind of
express
str = rundll32.exe
"%ProgramFiles%\INTERN~1\hmmapi.dll",OpenInboxHandler
str = "C:\PROGRA~1\MICROS~4\OFFICE11\OUTLOOK.EXE" /recycle
str = "C:\Program Files\Internet Explorer\iexplore.exe" -nohome
how can I extract parameter correctly?
If used split "-" "," "/"
str might have "-" "," "/" elsewhere other than parameter




:

Hi,

I think you should use
System.Diagnostics.ProcessStartInfo pStartInfo = new
System.Diagnostics.ProcessStartInfo ("filename", "parameters");
and then use Process.Start (pStartInfo) to start the process.

Hope that helps.

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"Steve" <[email protected]> je napisal v sporoeilo
...
I used System.Diagnostics.Process.Start(str) to launch application.
str is based on the registry setting, in registry, it might be
str = rundll32.exe
"%ProgramFiles%\INTERN~1\hmmapi.dll",OpenInboxHandler
str = "C:\PROGRA~1\MICROS~4\OFFICE11\OUTLOOK.EXE" /recycle
str = "C:\Program Files\Internet Explorer\iexplore.exe" -nohome

System.Diagnostics.Process.Start(str) can't launch with parameter,
and
there
might be any kind of the parameter in registry with exe file, what
should
I
do?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top