How to return to the original directory after invoking change directory in DOS batch?

If you want to ACCESS the original directory after changed it, store it in a variable this way: SET ORIGINAL=%CD% and use %ORIGINAL% later, for example: dir /b *. Tex > %original%\%2.txt.

If you want to RETURN to original directory, do the first change with PUSHD and return with POPD. That is, moves to %1 directory must be achieved with PUSHD %1 instead of CD %1, and the return is achieved with POPD instead of CD where? If you want to ACCESS the original directory after changed it, store it in a variable this way: SET ORIGINAL=%CD% and use %ORIGINAL% later, for example: dir /b *.

Tex > %original%\%2.txt.

1 +1: additionally PUSHD is used to CD into network-attached drives, as CD will not allow you to. – Mechaflash Aug 9 at 18:33 @Mechaflash: Wow, didn't know this, nice! – schnaader Aug 9 at 18:48.

You can always set %cd% to a variable before changing directories: set current="%cd%" cd "C:\Some\Other\Folder" cd "%current%" In most cases, creating a variable with the directory is used in Batch Scripts. If the script is semi-lengthy, I will define my variables in the beginning of the script that includes important paths, files, subs, and/or long commands. @ECHO OFF REM Variables ::Programs SET save_attachments=C:\Program Files\APED\Program\save_attachments.

Vbs SET sendemail=C:\Program Files\APED\Program\sendkeys. Vbs SET tb=C:\Program Files\Mozilla Thunderbird\thunderbird. Exe SET fox=C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.

Exe SET spool=C:\WINDOWS\system32\PRNJOBS. Vbs ::Directories SET new=C:\Program Files\APED\New SET printing=C:\Program Files\APED\Printing SET finish=C:\Program Files\APED\Finish SET messages=C:\Program Files\APED\Script_Messages SET nonpdf=C:\Program Files\APED\NonPDFfiles SET errorfiles=C:\Program Files\APED\Error Files ::Important Files SET printlog=C:\Program Files\APED\Script_Messages\PrintLOG. Txt SET printemail=C:\Program Files\APED\Script_Messages\EmailPrintLOG.

Txt SET errorlog=C:\Program Files\APED\Script_Messages\ErrorLOG. Txt SET erroremail=C:\Program Files\APED\Script_Messages\EmailErrorLOG. Txt SET movefiles=C:\Program Files\APED\Script_Messages\MoveFiles.

Txt However, PUSHD and POPD are great solutions if it is short and sweet imo.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions