in reply to Re^5: Win32::Process - need help from an expert!
in thread Win32::Process - need help from an expert!

When I run "helloworld.bat" from the command line it works so that's not true, at least not for me. I have an xserver installed which comes with some unix funtionality ( like ls, echo, etc ). It's called Xvision. So on the command line if I type "echo helloworld" I see "helloworld" on the next line. Can you give me a better test, something that will create a file?
  • Comment on Re^6: Win32::Process - need help from an expert!

Replies are listed 'Best First'.
Re^7: Win32::Process - need help from an expert!
by somuchh8 (Novice) on Sep 13, 2007 at 15:35 UTC
    I just tried 'echo' on a few different machines ( I know that at least one did NOT have an xserver installed ) and they all work like I expect. From the command line if you type "echo hi" you will see "hi" on the next line. It may not be a program but it is still a recognized command on windows, as far as I can tell at least, I may be wrong.

      It'll work from the command line, because the command line can execute more than just programs. DOS has some builtin commands. But we're talking about CreateProcess, which runs programs.

      Just like DOS can't execute Perl commands (e.g. print), Perl can't execute DOS commands (e.g. echo). echo is built in cmd.exe and command.com and not a program, so CreateProcess can't run it. However, just like you can run perl to execute Perl commands (perl -le "print 'Hello World'"), you can run cmd to execute DOS commands (cmd /c "echo Hello World").

        I see what you mean. This is why I put the command into a bat file. Can perl not execute a bat file? I'll try using cmd.exe /c "echo hello world" and see if that works because my test does not create the hello world text file like it should. I appoligize for my newbness I am mostly a Unix / Linux programmer.