From: John Vottero on
"Breakable" <igalvelis(a)gmail.com> wrote in message
news:bc640e16-b7f5-4c20-a62f-66d9e754fc3b(a)e28g2000vbd.googlegroups.com...
> Thank you everyone for trying to help, but I don't see a solution
> yet.
> Just to be absolutely clear "iexplore http://google.com" was provided
> just as an example - to reproduce the situation - I don't need to open
> pages or start internet explorer. It can be just as well "notepad
> a.txt"
> To clarify again the problem is that
> Process.Start("notepad a.txt")
> gives me "The system cannot find the file specified" exception.
> Where the
> Process.Start("notepad","a.txt")
> works.

I think you can do:

Process.Start("cmd.exe /C notepad a.txt")

which simple involves adding "cmd.exe /C " to the beginning of your string.



From: Breakable on
On May 20, 7:56 pm, Jackie <Jac...(a)an.on> wrote:
> I think I would just go the parsing way. It's not that hard to do
> either. I assume there are some free simple parsers out there for this
> purpose if you don't want to write one on your own.
>
> If I understand this correctly now...
>
> A user could type in "notepad something.txt", and your application knows
> that "notepad" is the executable/command and "something.txt" is a part
> of the arguments.
>
> Then you just specify the user-inputted executable/command as the first
> argument to Process.Start() and the user-inputted arguments as the
> second argument.
>
> Do I understand this correctly?
Yes, you understand correctly.
I was not able to find any parsers that are not huge (~2mb), just to
do this simple task.
From: Breakable on
> "Breakable" <igalve...(a)gmail.com> wrote in message
> I think you can do:
>
> Process.Start("cmd.exe /C notepad a.txt")
>
> which simple involves adding "cmd.exe /C " to the beginning of your string.
This is basically the same as adding "start " at the beginning. I
believe there can be some pitfalls, but I am not sure what they are.
From: Jackie on
On 5/21/2010 11:44, Breakable wrote:
>> "Breakable"<igalve...(a)gmail.com> wrote in message
>> I think you can do:
>>
>> Process.Start("cmd.exe /C notepad a.txt")
>>
>> which simple involves adding "cmd.exe /C " to the beginning of your string.
> This is basically the same as adding "start " at the beginning. I
> believe there can be some pitfalls, but I am not sure what they are.

http://stackoverflow.com/questions/298830/split-string-containing-command-line-parameters-into-string-in-c/467313#467313

This seems like an *okay* solution (not great but not bad either). Seems
to be doing the job at least.
From: Jackie on
On 5/21/2010 12:21, Jackie wrote:
> On 5/21/2010 11:44, Breakable wrote:
>>> "Breakable"<igalve...(a)gmail.com> wrote in message
>>> I think you can do:
>>>
>>> Process.Start("cmd.exe /C notepad a.txt")
>>>
>>> which simple involves adding "cmd.exe /C " to the beginning of your
>>> string.
>> This is basically the same as adding "start " at the beginning. I
>> believe there can be some pitfalls, but I am not sure what they are.
>
> http://stackoverflow.com/questions/298830/split-string-containing-command-line-parameters-into-string-in-c/467313#467313
>
>
> This seems like an *okay* solution (not great but not bad either). Seems
> to be doing the job at least.

I see that these functions does quite some copying of strings that isn't
such a good idea.