By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,218 Members | 1,342 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,218 IT Pros & Developers. It's quick & easy.

Any way I can launch origram with parameter

P: n/a
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",OpenInboxHand ler
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?
Nov 16 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Steve wrote:
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",OpenInboxHand ler
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.
Nov 16 '05 #2

P: n/a
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" <St***@discussions.microsoft.com> je napisal v sporočilo
news:B8**********************************@microsof t.com ...
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",OpenInboxHand ler
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?

Nov 16 '05 #3

P: n/a
For str is get from registry, str parameter might be all kind of express
str = rundll32.exe "%ProgramFiles%\INTERN~1\hmmapi.dll",OpenInboxHand ler
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


"Peter Jausovec" wrote:
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" <St***@discussions.microsoft.com> je napisal v sporoèilo
news:B8**********************************@microsof t.com ...
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",OpenInboxHand ler
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?


Nov 16 '05 #4

P: n/a
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" <St***@discussions.microsoft.com> je napisal v sporočilo
news:84**********************************@microsof t.com ...
For str is get from registry, str parameter might be all kind of express
str = rundll32.exe "%ProgramFiles%\INTERN~1\hmmapi.dll",OpenInboxHand ler
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


"Peter Jausovec" wrote:
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" <St***@discussions.microsoft.com> je napisal v sporoeilo
news:B8**********************************@microsof t.com ...
>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",OpenInboxHand ler
> 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?
>
>


Nov 16 '05 #5

P: n/a
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" wrote:
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" <St***@discussions.microsoft.com> je napisal v sporoèilo
news:84**********************************@microsof t.com ...
For str is get from registry, str parameter might be all kind of express
str = rundll32.exe "%ProgramFiles%\INTERN~1\hmmapi.dll",OpenInboxHand ler
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


"Peter Jausovec" wrote:
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" <St***@discussions.microsoft.com> je napisal v sporoeilo
news:B8**********************************@microsof t.com ...
>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",OpenInboxHand ler
> 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?
>
>


Nov 16 '05 #6

P: n/a
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" <St***@discussions.microsoft.com> je napisal v sporočilo
news:62**********************************@microsof t.com ...
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" wrote:
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" <St***@discussions.microsoft.com> je napisal v sporoeilo
news:84**********************************@microsof t.com ...
> For str is get from registry, str parameter might be all kind of
> express
> str = rundll32.exe
> "%ProgramFiles%\INTERN~1\hmmapi.dll",OpenInboxHand ler
> 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
>
>
>
>
> "Peter Jausovec" wrote:
>
>> 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" <St***@discussions.microsoft.com> je napisal v sporoeilo
>> news:B8**********************************@microsof t.com ...
>> >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",OpenInboxHand ler
>> > 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?
>> >
>> >
>>
>>
>>


Nov 16 '05 #7

P: n/a
Peter,

Thanks a lot for your help.

"Peter Jausovec" wrote:
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" <St***@discussions.microsoft.com> je napisal v sporoèilo
news:62**********************************@microsof t.com ...
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" wrote:
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" <St***@discussions.microsoft.com> je napisal v sporoeilo
news:84**********************************@microsof t.com ...
> For str is get from registry, str parameter might be all kind of
> express
> str = rundll32.exe
> "%ProgramFiles%\INTERN~1\hmmapi.dll",OpenInboxHand ler
> 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
>
>
>
>
> "Peter Jausovec" wrote:
>
>> 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" <St***@discussions.microsoft.com> je napisal v sporoeilo
>> news:B8**********************************@microsof t.com ...
>> >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",OpenInboxHand ler
>> > 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?
>> >
>> >
>>
>>
>>


Nov 16 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.