Results 1 to 14 of 14
  1. #1
    New Lounger
    Join Date
    Feb 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    How to use cd command in Window

    Hi all, I'm a Linux user just starting to get the hang of Windows 7. How can one perform these functions with the Windows cd command:
    1) Go back to the previous directory (cd - in Bash)
    2) Go to the user's home directory (cd ~ in Bash)
    3) Bookmark a directory (not built into bash, but cdargs or DerB can be added)

    Thanks

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    1) CD ..
    2) CD %HOMEPATH%
    3) You's have to save it into a temp variable that would only be good for the current Command Session.
    In a command window type HELP for a list of commands. Take a look at PUSHD & POPD these may fill your need.

    Welcome to the wonderful world of Windows.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. The Following User Says Thank You to RetiredGeek For This Useful Post:

    dotancohen (2011-07-21)

  4. #3
    New Lounger
    Join Date
    Feb 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks, RetiredGeek!

    1) That goes up a directory, but not to the last directory that I was in. For instance:
    C:\Users>chdir
    C:\Users\dotancohen\some\long\filepath
    C:\Users>cd C:\Windows
    Now how would I get back to C:\Users\dotancohen\some\long\filepath

    2) Thank you!

    3) Thanks. For some reason it's not working:
    C:\Users\dotancohen>pushd
    C:\Users\dotancohen>cd C:\Windows
    C:\Windows>popd
    However, when I specify the target directory it does in fact work. This is not much of a help as it _still_ requires me to type in the whole directory! The help page implies that the command should deduct the current directory automatically, is this not the case?

    Thank you very much! I am enjoying Windows 7 but I still find it very annoying from a UI perspective. For instance, I need to find a file manager with an Up button.

  5. #4
    New Lounger
    Join Date
    Feb 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I now see how to use pushd:
    C:\Users\dotancohen>pushd C:\Windows
    C:\Windows>popd
    C:\Users\dotancohen>

    This might work as a replacement for (1) and (3), I'll try it for some time and see how it goes. Thank you RetiredGeek!

  6. #5
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    If you want to get into serious scripting you can give PowerShell a try. It's built in to Win 7.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  7. #6
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,421
    Thanks
    33
    Thanked 195 Times in 175 Posts
    I object! BATch files are quite serious scripting!
    BATcher

    Time prevents everything happening all at once...

  8. #7
    Gold Lounger
    Join Date
    Oct 2007
    Location
    Johnson City, Tennessee, USA
    Posts
    3,202
    Thanks
    37
    Thanked 215 Times in 202 Posts
    Quote Originally Posted by dotancohen View Post
    Hi all, I'm a Linux user just starting to get the hang of Windows 7. How can one perform these functions with the Windows cd command:
    dotancohen,

    Hello... I have a question that's been rolling around my "pea sized brain" since i read your post . I mean no disrespect ..In fact I'm using "LINUX Katya" as i am typing . It seems to me that a while back in the "good ole days" that people split into two distinct groups ...The ones that "hated DOS" and all that went with it... and the ones that liked the GUI concept from apple, etc. On any LINUX forum you can read about the "Terminal" and follow pages of people conversing in LINUX command speak ...They seem to revel in it... For the most part "Windows" people generally hate the "Command prompt" Most seem to feel that its a "Throwback" to days gone by. Now on to my question... If you can (in Windows) just click on "Computer" and see all drives and partitions present ...and with one click see the root directory of any one. Opening any that you would want to see, or explore, Using the forward and back arrows ...why would you want to use the cd, push ,pop, etc. The whole point of Windows was to get far away from DOS \ LINUX ..It would be like me going to a UBUNTU forum and asking if there is any way of never dealing with the "Terminal".. As i said no disrespect.... just can't figure why Regards Fred
    PlainFred

    None are so hopelessly enslaved as those who falsely believe they are free (J. W. Von Goethe)

  9. #8
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Quote Originally Posted by Just Plain Fred View Post
    dotancohen,
    just can't figure why Regards Fred
    Fred,

    I can answer that one....because I WANT TO BE IN CONTROL! Or as put more gracefully by 'Ole Blue Eyes, "I did it my way." All Old, and maybe young too, programmers will understand.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  10. #9
    Gold Lounger
    Join Date
    Oct 2007
    Location
    Johnson City, Tennessee, USA
    Posts
    3,202
    Thanks
    37
    Thanked 215 Times in 202 Posts
    Your "Geekness"

    Hello... Guess It's just way over my head... Don't get it..Or maybe it's that I'm still rebelling from having to take a course in "Assembly Language" Regards Fred
    Last edited by Just Plain Fred; 2011-07-23 at 15:24.
    PlainFred

    None are so hopelessly enslaved as those who falsely believe they are free (J. W. Von Goethe)

  11. #10
    5 Star Lounger
    Join Date
    Jan 2010
    Location
    Los Angeles, CA
    Posts
    828
    Thanks
    4
    Thanked 38 Times in 34 Posts
    Quote Originally Posted by Just Plain Fred View Post
    If you can (in Windows) just click on "Computer" and see all drives and partitions present ...and with one click see the root directory of any one. Opening any that you would want to see, or explore, Using the forward and back arrows ...why would you want to use the cd, push ,pop, etc. The whole point of Windows was to get far away from DOS \ LINUX
    One word: automation. Yes, you can do stuff in Windows by clicking around here and there and scrolling and moving the mouse. But if you want to repeatedly do the same thing over and over again, nothing beats the ability to be able to script something using a scripting language. (True, some GUI apps provide mechanisms to record and reply user actions, but some are fairly limited and they are all different.) So if you want to automate things with a batch file, you must learn how to use windows command line commands.

  12. #11
    Plutonium Lounger Medico's Avatar
    Join Date
    Dec 2009
    Location
    USA
    Posts
    12,631
    Thanks
    161
    Thanked 936 Times in 856 Posts
    Hey Fred, I guess it boils down to we (including myself in this group) older geezers (RG excepted) have other (in my case more fun) things to do with our very limited spare time (unfortunately, I'm not yet retired) than learn to script. Perhaps this is because we "play" with our PC's rather than "work" with our PC's. In my case I have gone so far as to download the new Linux and the app to run this within Windows, but do not have the time to install them, especially when I have been "ordered" to spend more time here (LOL)!! Perhaps someday in the hopfully distant future (I want to live to the distant future) my priorities will change and I will jump in as RG has successfully done, but for now I'll keep clicking away to accomplish what I need to accomplish.
    BACKUP...BACKUP...BACKUP
    Have a Great Day! Ted


    Sony Vaio Laptop, 2.53 GHz Duo Core Intel CPU, 8 GB RAM, 320 GB HD
    Win 8 Pro (64 Bit), IE 10 (64 Bit)


    Complete PC Specs: By Speccy

  13. #12
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Ok, It's time to fess up. I've been programming all my adult life both as a vocation and avocation! I consider my self extremely lucky that I was able to work my entire career at my hobby! I've always sought out the challenge to do what others said couldn't be done. I've pretty much found that there isn't anything you can't do with a computer if you're either smart enough, tenacious enough, have enough time, or have enough money. Usually, when some one says "it can't be done" they are really saying they don't know how to do it and don't want to expend one of the above to find out how. I'd say the progress in computer technology over the last 60+ years pretty much proves this theory.

    Thus endeth the sermon for today...

    P.S. It's really all about who's in CONTROL.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  14. #13
    Plutonium Lounger Medico's Avatar
    Join Date
    Dec 2009
    Location
    USA
    Posts
    12,631
    Thanks
    161
    Thanked 936 Times in 856 Posts
    RG, it sounds as though you have been very fortunate in your career activities. Working and making a living at your hobby has to be an ideal vocation. Unfortunately most of us "baby boomers" have not been so lucky, so we have to find the spare time to do these things. I fit a little programming in the early days in college using Fortran (remember that oldie) and then tinkered a little in HTML, but find I no longer have the time to tinker. Priorities change, etc. perhaps some day. Enjoy your time. If I need some programming done I know who to call!

    Stay In Control
    Last edited by Medico; 2011-07-24 at 13:58.
    BACKUP...BACKUP...BACKUP
    Have a Great Day! Ted


    Sony Vaio Laptop, 2.53 GHz Duo Core Intel CPU, 8 GB RAM, 320 GB HD
    Win 8 Pro (64 Bit), IE 10 (64 Bit)


    Complete PC Specs: By Speccy

  15. #14
    Bronze Lounger DrWho's Avatar
    Join Date
    Dec 2009
    Location
    Central Florida
    Posts
    1,501
    Thanks
    30
    Thanked 205 Times in 163 Posts

    Cool

    I still set up new PC's at the rate of two or three a month. I do extensive tweaking, tuning and adding and deleting.
    If I did everything by the keyboard, a typical setup (install) would take several hours.
    But Thank God and MS for DOS. I do 90+% of my setup using batch files, .reg scripts and .vbs scripts.
    I can usually do the basic setup in less than an hour, even with all the obligatory reboots.

    The question (Topic) was how to use the 'CD' command.

    CD\ will jump you back to the root directory of the HD you're working in.
    CD.. will take you back to your previous directory, one step above where you are.
    CD "C:\Windows" will take you to the Windows directory on drive C.

    At the command prompt, type CD /? and you will get this readout.

    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.

    Use the /D switch to change current drive in addition to changing current
    directory for a drive.

    If Command Extensions are enabled CHDIR changes as follows:

    The current directory string is converted to use the same case as
    the on disk names. So CD C:\TEMP would actually set the current
    directory to C:\Temp if that is the case on disk.

    CHDIR command does not treat spaces as delimiters, so it is possible to
    CD into a subdirectory name that contains a space without surrounding
    the name with quotes. For example:

    cd \winnt\profiles\username\programs\start menu

    is the same as:

    cd "\winnt\profiles\username\programs\start menu"

    which is what you would have to type if extensions were disabled.

    I was able to get that printout by typing, at the command prompt, CD /?> C:\CD.txt

    The above readout appeared in the root directory of C: as a text file "CD.txt".
    That's an easy way to get any information on any DOS command.
    You can then pull up that text file in Wordpad, edit it, if you want and even print it out.

    Some printouts for commands like XCOPY are nearly a full page, so it's almost impossible to remember every switch that can be used with the program. A physical printout is extremely helpful.

    Cheers Mates!
    The Doctor

    Yes, for us control freaks, DOS is an absolute MUST HAVE.
    Even on my Windows 7 setup, DOS plays a big part in the everyday operation of the computer.
    If you really want to be "IN CHARGE" of your computer, learn DOS. It's every bit as important today, as it was 30+ years ago, but much more powerful and flexible. Many new commands have been added since then. I can't even keep up with all the new commands.
    Last edited by DrWho; 2011-07-31 at 13:21.
    Experience is truly the best teacher.

    Backup! Backup! Backup! GHOST Rocks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •