Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: No command window output when running script

by JennieInMI (Acolyte)
on Dec 29, 2012 at 22:55 UTC ( #1010856=note: print w/ replies, xml ) Need Help??


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

Hi Rob,

Thank you for this reply. It makes perfect sense. I wasn't storing what was returned and printing it, so nothing was output to the screen. Returning and outputting are not inherently equivalent.

I just tried out your example. Cd doesn't return a value so nothing is output with this example, but when I used dir instead I got a nice screenful of info. :-D I'm not on my work computer right now so I can't try out my tf command yet, but I will give it a try later. Thank you again for the answer.

Jennie


Comment on Re^2: No command window output when running script
Replies are listed 'Best First'.
Re^3: No command window output when running script
by syphilis (Canon) on Dec 29, 2012 at 23:26 UTC
    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

      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://1010856]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2015-07-29 23:02 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 (269 votes), past polls