Thanks for your help!!!  

Both "cmd /c dir" and "cmd /k dir" work for me.  With the option /k, the
dos console stayed open but the command "dir" and the output didn't
appear on the console.  Therefore, I had to write the output a text file
to make sure things really happened.

Heidi

-----Original Message-----
From: R. Joseph Newton [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 12, 2003 8:38 AM
To: Bakken, Luke
Cc: Heidi Ng; [EMAIL PROTECTED]
Subject: Re: Running a dos command with Win32::Process?


"Bakken, Luke" wrote:

> > I want to know if I can open a dos command console and run a command

> > on it (i.e. dir or cd $some_dir) with the Win32::Process module.  I 
> > used the following code but the command didn't get pass into the new

> > dos console that it opened.
>
> If I remember correctly, dir and cd are built-in to the cmd shell. So 
> you would have to do something like this for your command:
>
> cmd /c "cd somedir"
> cmd /c "dir somedir"
>
> Luke

Might be better to use the /K switch, since this leaves the console
open. cmd /k "cd somedir" cmd /k "dir somedir"

E:\d_drive\perlStuff\guests>cmd /?
Starts a new instance of the Windows 2000 command interpreter

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON |
/V:OFF]
    [[/S] [/C | /K] string]

/C      Carries out the command specified by string and then terminates
/K      Carries out the command specified by string but remains

Unfortunately, it does NOT seem to open a new window if run from a
console.  It simply runs the command in place.  It will spawn a window,
though, if run from the single-line "Run" utility on the Start menu.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to