http://www.perlmonks.org?node_id=998198


in reply to Re^2: Windows start /min
in thread Windows start /min

Hi,

I am having trouble with the "start" command.

Here is the contents of the PERL5SHELL environment variable:

c:\>echo %PERL5SHELL% cmd.exe /c
Calling the "dir" command works fine:
c:\>perl -e "system(\"dir\")" Datenträger in Laufwerk C: ist SYSTEM Volumeseriennummer: CA02-1E1F Verzeichnis von c:\ 03.08.2012 14:24 <DIR> cygwin 09.10.2012 18:01 <DIR> Daten ... 10.10.2012 08:59 <DIR> Windows 2 Datei(en), 15.460 Bytes 15 Verzeichnis(se), 144.527.847.424 Bytes frei
Calling "start dir" from Perl does not work:
c:\>perl -e "system(\"start dir\")" start: dir: Das System kann die angegebene Datei nicht finden.
Calling "start dir" directly opens a new window with the output from above:
c:\>start dir
Any idea what might cause this behaviour??

Yours

Markus

Replies are listed 'Best First'.
Re^4: Windows start /min
by BrowserUk (Patriarch) on Oct 10, 2012 at 11:06 UTC
    Calling "start dir" directly opens a new window with the output from above:

    If you don't want a new window, use the /b option: start /b dir.

    But I suspect that your real problem is the one haven't described. Ie. Why are you using start, rather than running dir directly?


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    RIP Neil Armstrong

Re^4: Windows start /min
by bulk88 (Priest) on Oct 10, 2012 at 21:58 UTC
    Calling "start dir" from Perl does not work:
    c:\>perl -e "system(\"start dir\")" start: dir: Das System kann die angegebene Datei nicht finden.
    dir is not a exe, it is a shell built in. start is also a shell built in. You will not find a start.exe in your C:\WINDOWS or any subfolder under that. Only cmd understands what dir is.

    try
    perl -e "system('cmd /c dir');"
    or
    perl -e "system('cmd /c start dir');"
      FWIW, perl -le "system \"dir\"" works just fine, but then I don't have any autoloaded modules, no sitecustomize, no PERL env vars to override any defaults
Re^4: Windows start /min
by Anonymous Monk on Oct 10, 2012 at 11:10 UTC

    Any idea what might cause this behaviour??

    You have some kind of "start" program? You're loading a module which replaces system and looks for a start.exe?

    Maybe cmd.exe changed again, but I don't think so, look

    C:\>start blahblah The system cannot find the file blahblah. C:\>perl -e " system q/start blahblah/" The system cannot find the file blahblah.
    Notice it doesn't say "start: dir: The system cannot find the file blahblah."