Cd doesn't return a value so nothing is output with this exampleInteresting ... 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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.