Link to home
Start Free TrialLog in
Avatar of Janice Cook
Janice CookFlag for United States of America

asked on

Need help understanding MS DOS commands

I asked a question in a MS newsgroup, but I still don't understand the answer:   I wanted to print out the list of folders in the Outlook Express message pane, and the following was the recommendation of one way to accomplish it:

(Is a list of the "folders" which actually contain messages good enough?

You could adapt this suggestion I made to someone who wanted
"a list of subscribed newsgroups"...

<paste>
If you only had one news account and you hadn't visited newsgroups
but not subscribed to them you could get a list of your  *.dbx  in your
Message Store subdirectory as a good approximation to a list of your
"subscribed" newsgroups.

E.g. right-click Properties on an Outlook bar item.
Then press Tab to select the filename under the label:
    "This folder is stored in the following file:"
Capture that selection.  (E.g. press Ctrl-c)
Switch to a cmd window and type:   cd  /d
(with a trailing space <g>)
Then right-click, Paste.   Remove the filename (e.g. press Backspace
back to the last backslash (\)  and press Enter.

Then enter:   dir/b/on  *.dbx   >dbx.txt
(or whatever pattern you would like to list just some newsgroup .dbx,
e.g. for  just microsoft.public  ones you could enter:
    dir/b/on  microsoft.public.*.dbx   >mpdbx.txt
etc.)

Note the filter on that line captures the output of the command
into the same directory so it can be browsed and further edited
by Notepad (or printed or whatever else you like with it later.}

My response:

Robert,

I went to the DOS command window and it was pointing to C:\Documents and
Settings\HP_Administrator>.  I cd\ back to the C:\ prompt and then pasted in
the directory for one of  my dbx files in OE as follows:
C:\Documents and Settings\HP_Administrator\Local Settings\Application
Data\Identities\{0997C9F9-D1FA-4A60-90E4-0FF3700CE7B1}\Microsoft\Outlook
Express\Weekend Letter.dbx

I first backspaced over Weekend Letter.dbx and hit Enter

I got the following error message:
"Documents" is not recognized as an internal or external command, operable
program or batch file

Can you tell me what I'm doing wrong?

MVP's response:
Not following instructions?
Specifically, there is no sign that you did this

E.g. you captured the path and switched to a cmd window all right
but then just pasted the path in as if it was a command to be executed
from the drive root?   Note the whole idea is to paste the path as an
_operand_ of a command that you start typing:

    CD  /D

Also, when you do what I suggest you don't need to use quotes around
your operand, even if the path you are pasting contains spaces.
The first space in your pasted path  is what caused the misleading error
message you got.   ; )
-------------------------------------------------------------------------------
I don't know what the cd /D does...., and I don't know where the spaces are. Please write a "for dummies" answer. Thanks in advance.

Avatar of hulent
hulent
Flag of United States of America image

Try putting quotation marks around c:\Document and Settings\... such as this:

"C:\Documents and Settings\HP_Administrator\Local Settings\Application
Data\Identities\{0997C9F9-D1FA-4A60-90E4-0FF3700CE7B1}\Microsoft\Outlook
Express\Weekend Letter.dbx"
SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Quotation marks wont help...
Here is what is happening:
You want to change the directory of your command prompt to be in the same directory as your outlook folders. The CD /D command means Change Directory and, if necessary Drive (/D) to get to the following folder: <paste your folder here>
Once executed, you will be in the same folder as your outlook folders.
The next command is:
dir/b/on *.dbx >Folders.txt
This command says : List all of the DBX files (Outlook Folders) in this folder in a "/b" bare format (no dates, filesizes, etc), "/on" sorted by name and place those file names in a text document named Folders.txt.
The next command that I would run from the prompt would be:
notepad Folders.txt
This will open your new list of outlook folders so you can deal with them as you wish.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
To clarify, you will need quotes if the path contains spaces...

C:\Documents and Settings would be recognized as three parameters to any dos command.

CD /D "C:\Documents and Settings" is the correct method to change to that directory...
To clarify, you will need quotes if the path contains spaces...
That is incorrect. If you are using Windows 2000/XP/Vista then the command interpreter fully comprehends Windows folder naming conventions, spaces and all.

sshot.png
And that's not entirely accurate either.
Try using any external command against Documents and Settings.
Even some internal commands will fail - for example, try using "DIR" against Documents and Settings without enclosing it in quotes.

It's good practice to enclose all folder names with quotes, then you won't have to guess if it'll work with that command or not...

Try using any external command against Documents and Settings.
With all due respect, that is not the problem that the author is facing. S/he needs to CD to the outlook folders directory, which works just as described. If you read the authors post carefully:
I went to the DOS command window and it was pointing to C:\Documents and
Settings\HP_Administrator>.  I cd\ back to the C:\ prompt and then pasted in
the directory for one of  my dbx files in OE as follows:
C:\Documents and Settings\HP_Administrator\Local Settings\Application
Data\Identities\{0997C9F9-D1FA-4A60-90E4-0FF3700CE7B1}\Microsoft\Outlook
Express\Weekend Letter.dbx

I first backspaced over Weekend Letter.dbx and hit Enter

I got the following error message:
"Documents" is not recognized as an internal or external command, operable
program or batch file

Can you tell me what I'm doing wrong?

You can see that the problem is that the path was not prefixed with CD /D. The interpreter tried to execute the path as a command, which of course resulted in the error described.
CD will always work with valid paths, enclosed with quotes or not. The follow-up commands that need to be executed do not involve paths at all, so... in this case... quotes wont help.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh yes, there is one other issue that you specifically mentioned, and which has confused you.

The CD command "Changes Directory" to whatever path you tell it to change into.  The command  CHDIR  does the same thing.

The CD \  command just tells CMD to go back to the Root of the drive that you are currently on, in your case to C:\

There are other symbols you can use.  A double-dot    CD ..   will go UP one level.  So, having opened to the prompt:

C:\Documents and Settings\HP_Administrator>

if you were to issue the command   cd  ..

it would take you BACK UP to:

C:\Documents and Settings>

To go FORWARDS, ie, DOWN through the folders and sub-folders, you then need to specify a path to that folder.

Let's assume that you want to go from there downwards into the "HP_Administrator" folder and then into the sub-folder of that "Local Settings", you could type the command:

cd HP_Administrator\Local Settings

to end up here:

C:\Documents and Settings\HP_Administrator\Local Settings>

It is also possible to go Backwards (up) and then Forwards (down) in one command.  Let's assume that you want to back-pedal from the above prompt to get to the
C:\Documents and Settings\All Users
folder.  That's Back (Up) two steps and then Forward (Down) one.

The following command would change directory into it:

cd ..\..\All Users

Similarly, if you wanted to go all the way back up to the root and then forwards to the "Windows" folder, you could use this command from wherever you are:

cd \Windows

That's a whole lot easier than (assuming you are currently in the HP_Administrator\Local Settings folder):

cd ..\..\..\Windows

When you are dealing with different Drive Letters, Windows XP differs from Old "DOS" as found in Win98.  To change to a different DRIVE in OLD DOS, you DO NOT use the Change Directory command, because the different drive letter is not a "Directory".  To change to a different drive, you had to issue the command (assuming you were changing to the D:\ Drive):

D:

Windows XP's command line allows you to change "directory" to a different DRIVE, and additionally also specify a Folder to go to on that drive.  That's what sirbounty was saying earlier when he gave the CD /P switch.

If you are in the C:\Documents and Settings\HP_Technician> folder in a command window and you want to move into the following folder on a 2nd hard drive:

D:\My Stuff\Pictures

the following command will take you there:

cd /d "D:\My Stuff\Pictures"

If you leave out the /D switch, it will remember that you have decided to change directory on the D: Drive to the \My Stuff\Pictures folder, but it will NOT take you there.  The /D is needed to actually do the change.

Something to be aware of, when talking about how the Windows XP CMD remembers what directory on another drive you told it to change to, is that if you just change drives, then it will go to the folder on that drive that you previously specified.  Here's what I mean, and is taken from the above hypothetical folders on a 2nd hard drive with the letter D:

While in the folder: C:\Documents and Settings\HP_Technician>
you type the CD command intending that it MOVES  to the "D:\My Stuff\Pictures" folder, but you forget the /D switch, ie. the command:

cd "D:\My Stuff\Pictures"

You will see immediately underneath the prompt you were at, that it acknowledged the CD command, but it just came right back to the:
C:\Documents and Settings\HP_Technician>
prompt again.

If you now type the command:

D:

it will take you right into the "D:\My Stuff\Pictures" folder, because it has remembered that you made that the "Current Directory" on that drive, but elected (accidentally) to physically go there.  The corect method of just changing drives, but NOT going to any folders on it, would have been:

cd /d D:\

The same is true when changing BACK to the drive you were on before, and you may find that you are back in the folder you were in.  Sometimes this is useful, but sometimes it is a pain.

Hopefully this sheds some light on what seems to be mysterious but is really quite simple if you just imagine a Windows Explorer folder tree while typing commands.

You may find the following Windows XP powertoy useful.  It adds a new Right-Click option "Command Window Here" for most folders.  Some System folders don't show the option.  The command window will open changed into that directory.

Open Command Window Here:
http://download.microsoft.com/download/whistler/Install/2/WXP/EN-US/CmdHerePowertoySetup.exe
Avatar of Janice Cook

ASKER

Will give feedback after holiday weekend...am working all 3 days!
For what it's worth...

I agree you can access the files in folders (directories in DOS) by CD-ing into the folder first however, it can be tedious having to type those long filenames.

Has anyone considered the use of SUBST ?

Suppose you CD into say "C:\Windows\Downloaded Program Files" frequently, or you want to get to it quickly, then you can assign the target folder a drive letter such as:

SUBST J: "C:\Windows\Downloaded Program Files"

Now you can simply change into the folder as you would to another drive such as:

J:

And you're there!!

Change back to C:

C:

And you're back again.... Now back to J: again:

J:

You can now do a DIR or whatever grabs your fancy.



Also, suppose you're currently at C:\Temp, you could copy all the files from the current folder to the SUBST'd folder just as you would a normal drive ie:

COPY *.* J:



Finally, when you drop back into windows and fire up explorer, you'll notice a new drive appear named Local Disk (J):

Wow!! You say. Where did that come from?....

Hehehe....

Oh, to remove the SUBST assignment, enter the following:

SUBST /D J:

Simple eh! Good old DOS....



There are loads of applications for SUBST...

How about SUBSTing a folder with a long filename and then being able to access it using 16-bit prorams' FileOpen dialog boxes.
Fantastic work, guys, not enough points to go around. Thanks so very much!
Thank you Sheana