• How to use cd command in Window

    Home » Forums » AskWoody support » Windows » Windows – other » How to use cd command in Window

    Author
    Topic
    #477930

    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

    Viewing 8 reply threads
    Author
    Replies
    • #1289197

      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. :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

      • #1289204

        Thanks, RetiredGeek!

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

        2) Thank you!

        3) Thanks. For some reason it’s not working:
        C:Usersdotancohen>pushd
        C:Usersdotancohen>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.

    • #1289211

      I now see how to use pushd:
      C:Usersdotancohen>pushd C:Windows
      C:Windows>popd
      C:Usersdotancohen>

      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!

    • #1289253

      If you want to get into serious scripting you can give PowerShell a try. It’s built in to Win 7. :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1289315

      I object! BATch files are quite serious scripting!

      BATcher

      Plethora means a lot to me.

    • #1289539

      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:cheers: Regards Fred

      • #1289554

        dotancohen,
        just can’t figure why:cheers: Regards Fred

        Fred,

        I can answer that one….because I WANT TO BE IN CONTROL!:lol: Or as put more gracefully by ‘Ole Blue Eyes, “I did it my way.” All Old, and maybe young too, programmers will understand.:cheers:

        May the Forces of good computing be with you!

        RG

        PowerShell & VBA Rule!
        Computer Specs

        • #1289567

          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” :blink: Regards Fred

      • #1289570

        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.

    • #1289628

      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.

    • #1289643

      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!:cool: 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.:rolleyes: 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…:cheers:

      P.S. It’s really all about who’s in CONTROL.:evilgrin:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1289656

      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 :clapping:

    • #1290770

      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 winntprofilesusernameprogramsstart menu

      is the same as:

      cd “winntprofilesusernameprogramsstart 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.

    Viewing 8 reply threads
    Reply To: How to use cd command in Window

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: