Help with writing a batch file please.

layne151

Senior member
Aug 16, 2000
416
0
0
I am trying to write a batch file to to do the following any help out there?

Change from the C drive to the A drive
Create a directory named TEST
Change to that directory
Copy all DOC files from C:\MY DOCUMENTS to A:\test
Give a directory listing of all the files in A:\TEST in alphabetical order
 

AndyHui

Administrator Emeritus<br>Elite Member<br>AT FAQ M
Oct 9, 1999
13,141
17
81
Copy and paste from below the line.
-------

@ECHO OFF
SET DIRCMD=/OGN
A:
MD TEST
CD TEST
COPY C:\MYDOCU~1\*.DOC
DIR /P
 

vi edit

Elite Member
Super Moderator
Oct 28, 1999
62,484
8,345
126
Andy, what does the line &quot;SET DIRCMD=/OGN&quot; do?

Thanks!
 

AndyHui

Administrator Emeritus<br>Elite Member<br>AT FAQ M
Oct 9, 1999
13,141
17
81
vi_edit: SET DIRCMD=/OGN means to set the DIR command environment to sort order with directories first, then files, in alphabetical order.
 

Spiff

Senior member
Oct 10, 1999
439
0
0
@echo off
goto begin

********************************************************************
copytest.bat

written 9.13.00
by spiff

this batch file will:

- Change from the C drive to the A drive
- Create a directory named TEST
- Change to that directory
- Copy all DOC files from C:\MY DOCUMENTS to A:\test
- Give a directory listing of all the files in A:\TEST in
alphabetical order
- Put directory listing into a file called MyDocs.txt

*********************************************************************

:begin

a:
md test
cd\test
copy &quot;c:\my documents\*&quot; a:\test\*
@echo on
dir a:\test /o
@echo off
dir a:\test /o >a:\Mydocs.txt

:end