Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^3: No command window output when running script

by syphilis (Chancellor)
on Dec 29, 2012 at 23:26 UTC ( #1010859=note: print w/replies, xml ) Need Help??

in reply to Re^2: No command window output when running script
in thread No command window output when running script

Cd doesn't return a value so nothing is output with this example

Interesting ... and there's probably a good reason for that, but I don't know what it is.
Certainly, the behaviour you're seeing doesn't conform to the documentation I get for cd, which begins with:
C:\_32\C>cd /? Displays the name of or changes the current directory. CHDIR [/D] [drive:][path] CHDIR [..] CD [/D] [drive:][path] CD [..] .. Specifies that you want to change to the parent directory. Type CD drive: to display the current directory in the specified drive +. Type CD without parameters to display the current drive and directory. .....
Perhaps you're running in a different shell (I use cmd.exe), or perhaps your cmd.exe shell finds a different 'cd' implementation to run.
To force your cmd.exe shell to use its own implementation, I think you just need to involve a shell metacharacter in the command - eg:
cd <nul
Does that command print out the current directory for you ?

(Admittedly this has nothing to do with the subject you initially raised ... but I find it a little bit interesting.)


Replies are listed 'Best First'.
Re^4: No command window output when running script
by JennieInMI (Acolyte) on Dec 30, 2012 at 01:33 UTC

    Hi Rob,

    I apologize. My error. I do run cmd.exe and just reran your code example. cd was, indeed, returning a value. However, since the returned value looked exactly like the command prompt only minus the > sign I just didn't realize that it wasn't the command prompt. I'm not generally dense. I don't know what's wrong with me here lately. Anyway, your example was fine. I just messed up reviewing the result. Thank you again for the answer.



    After messing around with the syntax a little I did finally get it to work at the command line. Thanks again Rob.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010859]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2018-06-25 03:16 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.