Unfortunately I'm not sure what could be going wrong here.  This works for me 
on v1.x - I'm on Vista so I have to run from an admin command prompt (otherwise 
regedit doesn't find the file) but otherwise it just works - even if I use the 
code as you have it below.

Have you checked the ExitCode property of the process?

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luke Hoersten
Sent: Friday, June 22, 2007 8:47 AM
To: [email protected]
Subject: Re: [IronPython] System.Diagnostics.Process.Start only uses first 
argument

I'm not including the quotes. Those are just the strings I'm using,
similar to your example. I'm getting different results: Only the first
argument being sent in that string is being processed. The other is
being ignored. So either I get /s and no .reg file or I import
the .reg file and it prompts me. I'm writing a script so obviously
prompting is undesirable.

Here's my code:
name = "c:\\Windows\\regedit.exe"
args = "/s example.reg"
System.Diagnostics.Process.Start(name, args)

I've even tried waiting on the process to exit with WaitForExit() but
that still does not work.

I've read on Google about a lot of people having this similar problem
but people seem to give up before posting a solution. Any other ideas?

On Jun 22, 10:32 am, Dino Viehland <[EMAIL PROTECTED]>
wrote:
> How exactly are you passing this?  I assume the quotes aren't being included? 
>  The 1st form below prompts me and the 2nd form doesn't prompt (ignoring the 
> UAC prompt on Vista of course which is a whole other ball of wax), are you 
> doing something different?
>
> >>> import System
> >>> System.Diagnostics.Process.Start('regedit.exe', '"/s foo.reg"')
>
> <System.Diagnostics.Process object at 0x000000000000002B 
> [System.Diagnostics.Process (regedit)]>>>> 
> System.Diagnostics.Process.Start('regedit.exe', '/s foo.reg')
>
> <System.Diagnostics.Process object at 0x000000000000002C 
> [System.Diagnostics.Process (regedit)]>
>
> You could also check out the nt module where we have nt.popen (or os if you 
> have the CPython std lib installed) which takes a single command line (exe + 
> args) and we do the splitting for you - that'd also be compatible w/ CPython.
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luke Hoersten
> Sent: Friday, June 22, 2007 8:07 AM
> To: [EMAIL PROTECTED]
> Subject: [IronPython] System.Diagnostics.Process.Start only uses first 
> argument
>
> System.Diagnostics.Process.Start(app, args) should take a string of
> arguments delimited by spaces for the second argument of start which
> it will pass to app on stdin. I'm trying to run app = "regedit.exe"
> and args ="/s key.reg" but it's only recognizing the first argument
> (which is /s). If I remove /s, it runs the key but I want this to run
> silently.
>
> I've also tried ProcessStartInfo() but it suffers from the same
> problem. Does anyone have any more information on this or know how to
> work around this?
>
> Thanks,
> Luke
>
> _______________________________________________
> users mailing list
> [EMAIL PROTECTED]://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> users mailing list
> [EMAIL PROTECTED]://lists.ironpython.com/listinfo.cgi/users-ironpython.com

_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to