Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: CD command  (Read 10271 times)

0 Members and 1 Guest are viewing this topic.

Carbon Dudeoxide

  • Global Moderator

  • Mastermind
  • Thanked: 169
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Experience: Guru
  • OS: Mac OS
Re: CD command
« Reply #15 on: May 19, 2007, 09:38:24 AM »
he can use that to cd to his previous location.

contrex

  • Guest
Re: CD command
« Reply #16 on: May 19, 2007, 09:41:14 AM »

echo.      prints a blank line to the screen.


Yes I did know that.  ::)





and yet you asked anyway?        .... odd.



Maybe English is not your first language? I meant, "What is the reason why you have put a period after the echo command?", not "What does a period do after an echo command?"


Carbon Dudeoxide

  • Global Moderator

  • Mastermind
  • Thanked: 169
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Experience: Guru
  • OS: Mac OS
Re: CD command
« Reply #17 on: May 19, 2007, 09:43:42 AM »
Lol, what does it matter.
I find it easier for me to use 'echo. text' than 'echo  text'
You dont have to use the period for %cd:~20,0% but i did coz i could......

contrex

  • Guest
Re: CD command
« Reply #18 on: May 19, 2007, 09:46:37 AM »
he can use that to cd to his previous location.

Oh right. So I'm in D:\My Folders\*censored*\Mom don't look in here\Babes\Redheads and I

type CD d:\

So now I'm in d:\

I type your command and it cuts the last 20 characters off the directory name, which is actually 3 characters long, so I end up with an empty string, which ECHO interprets as a request to show ECHO status, so it says "ECHO is on", and that gets me back to my previous folder? Is that how it works?

That's a real clever DOS tip, dudeoxide! i would nevah have thunk of that all on my lonesome!


Carbon Dudeoxide

  • Global Moderator

  • Mastermind
  • Thanked: 169
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Experience: Guru
  • OS: Mac OS
Re: CD command
« Reply #19 on: May 19, 2007, 10:03:05 AM »
well then you change 20 to a number that suits you.

contrex

  • Guest
Re: CD command
« Reply #20 on: May 19, 2007, 10:07:49 AM »
It's only useful if "where you were before" is  a parent folder of where you are now. typing cd.. (enter) and then repeatedly recalling it with the up arrow would do the same thing.

GuruGary



    Adviser
    Re: CD command
    « Reply #21 on: May 19, 2007, 02:28:51 PM »
    Reinaker: You can use PUSHD and POPD.

    For example, if you start off in
    Contrex's directory of
    D:\My Folders\*censored*\Mom
    And you want to go to the directory D:\Foo, you could use the command
    Code: [Select]
    pushd \FooThen to get back to the previous directory do
    Code: [Select]
    popdOr if you wanted to go to C:\Documents and Settings you could use the command
    Code: [Select]
    pushd "C:\Documents and Settings"Then to get back to the previous directory do
    Code: [Select]
    popd
    Another tip ... if you are writing a batch file that changes directories and it ends up leaving you in a directory used by the batch file instead of the original, you can use the SETLOCAL command.  Example:
    Code: [Select]
    @echo off
    setlocal
    cd \Temp
    ren *.new *.old
    In this example the batch file would leave you in whatever directory you started in.  Without the SETLOCAL command, the batch file would leave you in \Temp.