views:

136

answers:

4

i need help making a batch file in ms dos to do certain commands like

a)Request from you to first press any key

b) List the contents of the C:\WINDOWS directory

c) Create a subdirectory on one of your local drives. Use your initials to name the subdirectory.

d) Copy all the text files from C:\WINDOWS directory into the new subdirectory.

e) Print one of the text files copied to your new subdirectory.

thank you all for the help

for e) i think you make call command to print

+2  A: 

I suggest you do a little research. This link may be helpful to you.

JosephStyons
+1  A: 

Command line help is your friend here for most of this. You will need to have input parameters specified for a number of the things you;re asking for, though.

As a quick search, try this article.

Hooloovoo
+5  A: 

You need to create a .bat file that has the following text:

a)Request from you to first press any key

pause

b) List the contents of the C:\WINDOWS directory

dir c:\windows

c) Create a subdirectory on one of your local drives. Use your initials to name the subdirectory.

md c:\ro

d) Copy all the text files from C:\WINDOWS directory into the new subdirectory.

copy c:\windows\*.txt c:\ro

Regarding printing files I'm not sure, if I remember correctly the simplest way is something like:

type file.txt > LPT1

To create a .bat file, you should type in:

copy con filename.bat
... print the relevant lines above

When finished press Ctrl-Z and Enter.

So, all in all, you should type in:

copy con filename.bat
pause
dir c:\windows
md c:\ro
copy c:\windows\*.txt c:\ro
type file.txt > LPT1

And then Ctrl-Z and Enter.

Update: If you don't want the commands to be printed to the user, you can add another line before pause that will contain @echo off.

Roee Adler
ok thanks what i start with was @echo off
If this worked for you then please mark as accepted. Thanks.
Roee Adler
+2  A: 

Check out Rob van der Woude's Scripting Pages, specifically the Batch Files section. He has an excellent reference with lots of tips and tricks that will help with most of these tasks.

palehorse