1.

Solve : CD command?

Answer»

he can use that to cd to his previous location.Quote from: WillyW on May 19, 2007, 09:36:59 AM

Quote from: contrex on May 19, 2007, 09:31:25 AM
Quote from: WillyW on May 19, 2007, 09:26:50 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?"

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......Quote from: Carbon Dudeoxide on May 19, 2007, 09:38:24 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!

well then you change 20 to a number that suits you.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.
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 *.oldIn 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.


Discussion

No Comment Found