Help with a DOS command in Vista

  • Thread starter Thread starter PT
  • Start date Start date
P

PT

Vista Ultimate - 64 bit

In one of my folders, I have an extensive sub- folder tree which I'd like to
print out as a Word file. Here's what I've done:

1. I click Start | Programs | Accessories | Command Prompt
2. Using the CD command, I get to the head folder of the desire sub-folder
tree
3. If I then run the command "Tree", the sub-folder tree scrolls by quickly
in the desired format - i.e., like a genealogy chart, with lines connecting
the various levels.

But if I try to pipe the output to a text or Word file using the command
tree>tree.txt or tree>.tree.doc, I get the tree.
But the nice lines linking the various levels are replaced by a sequence of
bogus characters.

The maddening thing is that I was earlier able to get the nice chart into a
Word document. But I neglected to record the steps, and can't reproduce
them.

Suggestions welcome.
 
I've played around a bit and found a solution you'll probably llike better:

Save your tree without using the /a switch.

Then, open the file in Word and select the Text Encoding option European-DOS
This makes for a prettier tree.
Your tree was encoded using the ANSI standard.

Isn't life complicated?
 
Voila! - Thanks

--

PT
DaveD said:
I've played around a bit and found a solution you'll probably llike
better:

Save your tree without using the /a switch.

Then, open the file in Word and select the Text Encoding option
European-DOS
This makes for a prettier tree.
Your tree was encoded using the ANSI standard.

Isn't life complicated?
 
BTW - If you do a lot of this, you might want to put a Command Prompt option
on your right-click context menu.
It allows you to open any directory in a Command Prompt (DOS) window,
without needing to type in a long string for the CD command.

Just cut and paste this text (without the *** of course) into a .reg file,
then load that and voila!

******************
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt]
@="Command Prompt"
[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt\command]
@="cmd.exe /k CD /d %1"

[HKEY_CLASSES_ROOT\Drive\shell\CommandPrompt]
@="Command Prompt"
[HKEY_CLASSES_ROOT\Drive\shell\CommandPrompt\command]
@="cmd.exe /k CD /d %1"
******************
 
You have to use the redirect symbol (>) :

tree c: /a >treefile.txt

That puts the output of the command to a file instead of the screen. It's a
standard command file (DOS) technique.

Then just double-click that file to open it (the .txt extension means it
opens in Notepad by default)

However, as I said to the original poster, you get a better-looking listing
by NOT using the /a switch, and letting the command default to ANSI output:

tree c: >treefile.txt

then right-click and open with Word.
Once in Word, select the file conversion option MS-DOS. That will format the
lines of the tree correctly.
 
Doesn't holding down the shift key then right clicking add the "Open Command
Window Here" without having to edit the registry?

DaveD said:
BTW - If you do a lot of this, you might want to put a Command Prompt
option on your right-click context menu.
It allows you to open any directory in a Command Prompt (DOS) window,
without needing to type in a long string for the CD command.

Just cut and paste this text (without the *** of course) into a .reg
file, then load that and voila!

******************
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt]
@="Command Prompt"
[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt\command]
@="cmd.exe /k CD /d %1"

[HKEY_CLASSES_ROOT\Drive\shell\CommandPrompt]
@="Command Prompt"
[HKEY_CLASSES_ROOT\Drive\shell\CommandPrompt\command]
@="cmd.exe /k CD /d %1"
******************
 
Right you are. I never tried that. Thanks for the tip


Gary M said:
Doesn't holding down the shift key then right clicking add the "Open
Command Window Here" without having to edit the registry?

DaveD said:
BTW - If you do a lot of this, you might want to put a Command Prompt
option on your right-click context menu.
It allows you to open any directory in a Command Prompt (DOS) window,
without needing to type in a long string for the CD command.

Just cut and paste this text (without the *** of course) into a .reg
file, then load that and voila!

******************
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt]
@="Command Prompt"
[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt\command]
@="cmd.exe /k CD /d %1"

[HKEY_CLASSES_ROOT\Drive\shell\CommandPrompt]
@="Command Prompt"
[HKEY_CLASSES_ROOT\Drive\shell\CommandPrompt\command]
@="cmd.exe /k CD /d %1"
******************


PT said:
Voila! - Thanks

--

PT
I've played around a bit and found a solution you'll probably llike
better:

Save your tree without using the /a switch.

Then, open the file in Word and select the Text Encoding option
European-DOS
This makes for a prettier tree.
Your tree was encoded using the ANSI standard.

Isn't life complicated?



TREE /? will give you the answer
You need to use the /a switch to save the file as ASCII


Vista Ultimate - 64 bit

In one of my folders, I have an extensive sub- folder tree which I'd
like to
print out as a Word file. Here's what I've done:

1. I click Start | Programs | Accessories | Command Prompt
2. Using the CD command, I get to the head folder of the desire
sub-folder
tree
3. If I then run the command "Tree", the sub-folder tree scrolls by
quickly
in the desired format - i.e., like a genealogy chart, with lines
connecting
the various levels.

But if I try to pipe the output to a text or Word file using the
command
tree>tree.txt or tree>.tree.doc, I get the tree.
But the nice lines linking the various levels are replaced by a
sequence of
bogus characters.

The maddening thing is that I was earlier able to get the nice chart
into a
Word document. But I neglected to record the steps, and can't
reproduce
them.

Suggestions welcome.
 
Back
Top