Go Back   PCMech Forums > Windows Support > Windows Legacy Support (XP and earlier)

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 05-26-2003, 02:03 PM   #1
Member (5 bit)
 
neillsmob's Avatar
 
Join Date: May 2003
Location: scotland
Posts: 18
Question Help creating batch file

I have this question that I'm not that sure of, I think I now the answer but again not sure.Here we go...
A user wants a batch file which copies all of their files from the C:\FINANCE and C:\DOCUMENTS directories onto a floppy disk and then lists the contents of the floppy disk.Write a batch file to do this. And my answer to the question is....

@ echo off
C:
cd\
copy C:\Finance\*.*A:
copy C:\Documents\*.*A:
cd\
cls
dir A:
hope I have wrote it out write. Thx for any response
neillsmob is offline   Reply With Quote
Old 05-26-2003, 02:47 PM   #2
Member (14 bit)
 
reboot's Avatar
 
Join Date: Mar 1999
Location: Kelowna, B.C., Canada
Posts: 9,138
That works, a couple of redundant lines.
If you want it automated, you need to add a bit though, and be careful of spaces, and using wildcards.
I would do it thus:

@echo off
cd\
a:
md Finance
md Documents
copy c:\finance\*.* a:\finance\*.*
copy c:\documents\*.* a:\finance\*.*
echo hit any key to list the contents of a:\finance
pause
cd a:\finanace
dir |more
echo hit any key to list the contents of a:\documents
pause
cd a:\documents
dir |more
echo hit any key to exit
pause
echo you may now close this window
end
__________________
Black holes are where God divided by zero...
Cheers, Jim

Jims Modems

Last edited by reboot; 05-26-2003 at 04:16 PM.
reboot is offline   Reply With Quote
Old 05-26-2003, 04:08 PM   #3
Member (14 bit)
Premium Member
 
TwoRails's Avatar
 
Join Date: Jan 2002
Location: The Great NorthWest
Posts: 12,594
The "|Y" (pipe Y) should be a "/Y" (forward slash Y).
TwoRails is offline   Reply With Quote
Old 05-26-2003, 04:09 PM   #4
Member (5 bit)
 
neillsmob's Avatar
 
Join Date: May 2003
Location: scotland
Posts: 18
thx m8, so thats 2 examples to make the batch file.thats back to you reboot.

Last edited by neillsmob; 05-26-2003 at 04:34 PM.
neillsmob is offline   Reply With Quote
Old 05-26-2003, 04:16 PM   #5
Member (14 bit)
 
reboot's Avatar
 
Join Date: Mar 1999
Location: Kelowna, B.C., Canada
Posts: 9,138
If I remember my DOS commands, the "/y" can be used within a statement, whereas the "|y" is used at the end.
To use /y in the example above, the line would read:
copy /y c:\finance\*.* a:\finance\*.*
Which is totally redundant anyhow, because of my failing memory, the copy command doesn't require a confirmation!
(I was thinking xcopy, not just copy...)
Edited above .bat example to reflect this...
reboot is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 11:51 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2