Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: No command window output when running script

by syphilis (Canon)
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.)

Cheers,
Rob


Comment on Re^3: No command window output when running script
Select or Download Code
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.

    Jennie

    Update:

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010859]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2015-07-05 18:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls