CMD command

D

Dr. Indera

hello,

i use to use <pre xp> cmd.exe to print a list of files in a folder.
i thought this was the syntax that i was using, but it doesn't print
anything.
cmd.exe /c dir "%1" >PRN

i've looked in the help and support center, but couldn't find any examples
to show me what i'm doing wrong.
i was able to add this to the registry, which would add a menu item, so when
i clicked on a folder in windows explorer and right clicked and selected the
option, a list would print of all the files in the folder that i selected.

any help would be greatly appreciated.
thank you.
 
J

Jerry

The book "Microsoft Windows Command Line" ISBN 0-7356-2038-5 has all the
info you need on running things under XP.
 
W

Wesley Vogel

See...
Print
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/print.mspx

-----

Also...

[[To print a directory listing, type:

dir > prn

When you specify prn, the directory list is sent to the printer attached to
the LPT1 port. If your printer is attached to a different port, you must
replace prn with the name of the correct port.

You can also redirect output of the dir command to a file by replacing prn
with a file name. You can also type a path. For example, to direct dir
output to the file Dir.doc in the Records directory, type:

dir > \records\dir.doc

If Dir.doc does not exist, dir creates it, unless the Records directory does
not exist. In that case, the following message appears:

File creation error

To display a list of all the file names with the .txt extension in all
directories on drive C, type:

dir c:\*.txt /w/o/s/p

Dir displays, in wide format, an alphabetized list of the matching file
names in each directory and pauses each time the screen fills up, until you
press a key to continue. ]]
From...
Dir
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/dir.mspx

-----

PRN
[[HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices

Data type Range Default value
REG_SZ Device name \DosDevices\LPT1

Description
Associates the PRN device name that applications use with the system's
internal name for the printer port.]]
http://www.microsoft.com/resources/...s/2000/server/reskit/en-us/regentry/29890.asp


--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
N

Nightowl

Dr. Indera wrote on Fri, 29 Jul 2005:
hello,

i use to use <pre xp> cmd.exe to print a list of files in a folder.
i thought this was the syntax that i was using, but it doesn't print
anything.
cmd.exe /c dir "%1" >PRN

i've looked in the help and support center, but couldn't find any examples
to show me what i'm doing wrong.
i was able to add this to the registry, which would add a menu item, so when
i clicked on a folder in windows explorer and right clicked and selected the
option, a list would print of all the files in the folder that i selected.

any help would be greatly appreciated.
thank you.


Hi Indera

Your command works fine in a batch file. The problem you're having is
because of that "%1", which is a placeholder standing in for a folder
name.

If you're trying to type this in the Run box or at a Command prompt, it
won't work; to do that, you need to give the name of the folder whose
files you want listed instead of "%1", like this:

cmd /c dir C:\icons >prn

If you're going to use it a lot, it would be more convenient to save
your command in Notepad as a .BAT file, say Filelist.bat, in a folder on
your path. Then you supply the name of the listing folder by typing it
after the name of the batch file, for example:

filelist C:\icons

When the batch file runs it will substitute "C:\icons" for "%1".

Hope this helps.
 
D

Dr. Indera

hi jerry,

thank you for the reference book. did you write it?

--
Indera
* * * * * * * * * *
Don't just live life.
Live life well.


: The book "Microsoft Windows Command Line" ISBN 0-7356-2038-5 has all the
: info you need on running things under XP.
:
: : > hello,
: >
: > i use to use <pre xp> cmd.exe to print a list of files in a folder.
: > i thought this was the syntax that i was using, but it doesn't print
: > anything.
: > cmd.exe /c dir "%1" >PRN
: >
: > i've looked in the help and support center, but couldn't find any
examples
: > to show me what i'm doing wrong.
: > i was able to add this to the registry, which would add a menu item, so
: > when
: > i clicked on a folder in windows explorer and right clicked and selected
: > the
: > option, a list would print of all the files in the folder that i
selected.
: >
: > any help would be greatly appreciated.
: > thank you.
: > --
: > Indera
: > * * * * * * * * * *
: > Don't just live life.
: > Live life well.
: >
: >
: >
:
:
 
D

Dr. Indera

thank you wesley.
i will read the info on the link you gave me.

--
Indera
* * * * * * * * * *
Don't just live life.
Live life well.


: See...
: Print
:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/print.mspx
:
: -----
:
: Also...
:
: [[To print a directory listing, type:
:
: dir > prn
:
: When you specify prn, the directory list is sent to the printer attached
to
: the LPT1 port. If your printer is attached to a different port, you must
: replace prn with the name of the correct port.
:
: You can also redirect output of the dir command to a file by replacing prn
: with a file name. You can also type a path. For example, to direct dir
: output to the file Dir.doc in the Records directory, type:
:
: dir > \records\dir.doc
:
: If Dir.doc does not exist, dir creates it, unless the Records directory
does
: not exist. In that case, the following message appears:
:
: File creation error
:
: To display a list of all the file names with the .txt extension in all
: directories on drive C, type:
:
: dir c:\*.txt /w/o/s/p
:
: Dir displays, in wide format, an alphabetized list of the matching file
: names in each directory and pauses each time the screen fills up, until
you
: press a key to continue. ]]
: From...
: Dir
:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/dir.mspx
:
: -----
:
: PRN
: [[HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices
:
: Data type Range Default value
: REG_SZ Device name \DosDevices\LPT1
:
: Description
: Associates the PRN device name that applications use with the system's
: internal name for the printer port.]]
:
http://www.microsoft.com/resources/...s/2000/server/reskit/en-us/regentry/29890.asp
:
:
: --
: Hope this helps. Let us know.
:
: Wes
: MS-MVP Windows Shell/User
:
: In : Dr. Indera <[email protected]> hunted and pecked:
: > hello,
: >
: > i use to use <pre xp> cmd.exe to print a list of files in a folder.
: > i thought this was the syntax that i was using, but it doesn't print
: > anything.
: > cmd.exe /c dir "%1" >PRN
: >
: > i've looked in the help and support center, but couldn't find any
examples
: > to show me what i'm doing wrong.
: > i was able to add this to the registry, which would add a menu item, so
: > when i clicked on a folder in windows explorer and right clicked and
: > selected the option, a list would print of all the files in the folder
: > that i selected.
: >
: > any help would be greatly appreciated.
: > thank you.
: > --
: > Indera
: > * * * * * * * * * *
: > Don't just live life.
: > Live life well.
:
 
D

Dr. Indera

ahhhh,
that explains why it isn't working.
i am getting things all mixed up.
thank you nightowl.
--
Indera
* * * * * * * * * *
Don't just live life.
Live life well.


: Dr. Indera wrote on Fri, 29 Jul 2005:
:
: >hello,
: >
: >i use to use <pre xp> cmd.exe to print a list of files in a folder.
: >i thought this was the syntax that i was using, but it doesn't print
: >anything.
: >cmd.exe /c dir "%1" >PRN
: >
: >i've looked in the help and support center, but couldn't find any
examples
: >to show me what i'm doing wrong.
: >i was able to add this to the registry, which would add a menu item, so
when
: >i clicked on a folder in windows explorer and right clicked and selected
the
: >option, a list would print of all the files in the folder that i
selected.
: >
: >any help would be greatly appreciated.
: >thank you.
:
:
: Hi Indera
:
: Your command works fine in a batch file. The problem you're having is
: because of that "%1", which is a placeholder standing in for a folder
: name.
:
: If you're trying to type this in the Run box or at a Command prompt, it
: won't work; to do that, you need to give the name of the folder whose
: files you want listed instead of "%1", like this:
:
: cmd /c dir C:\icons >prn
:
: If you're going to use it a lot, it would be more convenient to save
: your command in Notepad as a .BAT file, say Filelist.bat, in a folder on
: your path. Then you supply the name of the listing folder by typing it
: after the name of the batch file, for example:
:
: filelist C:\icons
:
: When the batch file runs it will substitute "C:\icons" for "%1".
:
: Hope this helps.
:
: --
: Nightowl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top