#1
  1. המבין יבין
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 2001
    Location
    Haifa
    Posts
    2,085
    Rep Power
    1485

    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
    . . . What is Firefox?
    . . . . . . What is Linux?
    . . . . . . . . . . . What is Love?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2007
    Posts
    1,513
    Rep Power
    1423
    1) You could add such a feature with a cd alias
    2) "cd %HOMEPATH%" or "cd $Home" might work under some circumstances.
    3) Take a look at pushd and popd.

    Regards, Jens

    Comments on this post

    • dotancohen agrees : Thank you!
  4. #3
  5. המבין יבין
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 2001
    Location
    Haifa
    Posts
    2,085
    Rep Power
    1485
    Originally Posted by JClasen
    Thanks, Jens. I've heard of Powershell, it looks like the standard Windows CLI is too anemic and I really should be using Powershell

    2) "cd %HOMEPATH%" or "cd $Home" might work under some circumstances.
    Nice, thanks! It is a lot to type, though.

    3) Take a look at pushd and popd.
    That is a bit limited but I suppose that it will do. I'll see if I might be able to define aliases in Powershell.

    Thanks!
    . . . What is Firefox?
    . . . . . . What is Linux?
    . . . . . . . . . . . What is Love?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2007
    Posts
    1,513
    Rep Power
    1423
    1) Will only go one directory up in the directory tree. If you didn't came from there, the previous directory is sth. else.

    Example:
    Code:
    c:\myDirectoy>cd \just\another\directory
    c:\just\another\directory>cd ..
    c:\just\another>
    cd - would allow him to come back to c:\myDirectory.

    2) That would only work, if the user directories really reside in c:\users. That's not always the case.

    Regards, Jens
  8. #5
  9. המבין יבין
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 2001
    Location
    Haifa
    Posts
    2,085
    Rep Power
    1485
    Originally Posted by JClasen
    1) Will only go one directory up in the directory tree. If you didn't came from there, the previous directory is sth. else.

    Example:
    Code:
    c:\myDirectoy>cd \just\another\directory
    c:\just\another\directory>cd ..
    c:\just\another>
    cd - would allow him to come back to c:\myDirectory.

    2) That would only work, if the user directories really reside in c:\users. That's not always the case.

    Regards, Jens
    What he said!
    . . . What is Firefox?
    . . . . . . What is Linux?
    . . . . . . . . . . . What is Love?

IMN logo majestic logo threadwatch logo seochat tools logo