|
Answer» I use to know how to create a batch file and for some reason forgot the steps. I want to create a bat file that will copy files from ONE network drive to another and over write with out prompt. Any helpYou may first map both network drives under DOS environment then use the copy command in batch file. The command you will use under Batch file is :
Copy D:\filename.exe E:\dirname /y
This command will not ask you to overwrite files on destination directory.
I hope you know how to map a network drive under DOS environment.Yes I do and here is the bat file I worte and it doesn't work.
@echo off if not defined RunIFWTask set RunIFWTask=1 & start "Image for Windows" /min %SystemRoot%\system32\cmd.exe /c "%0" & goto :EOF xcopy I:\DATA\Nws\inventry.dbf I:\MACHINE Department\datafiles\inventry.dbf /Y xcopy I:\DATA\Nws\openshop.dbf I:\Machine Department\datafiles\openshop.dbf /Y xcopy I:\DATA\Nws\invhist.dbf I:\Machine Department\datafiles\invhist.dbf /Y xcopy I:\DATA\Nws\foggrout.dbf I:\Machine Department\datafiles\foggrout.dbf /Y xcopy I:\DATA\Nws\oorddetl.dbf I:\Machine Department\datafiles\oorddetl.dbf /Y xcopy I:\DATA\Nws\rthist.dbf I:\Machine Department\datafiles\rthist.dbf /Y
I also used just copy INSTEAD of xcopy.
I am using XP ProThis may work:
Code: [Select]@echo off if .%RunIFWTask%==. set RunIFWTask=1 & start "Image for Windows" /min %SystemRoot%\system32\cmd.exe /c "%0" & goto :EOF xcopy I:\DATA\Nws\inventry.dbf I:\Machine Department\datafiles\inventry.dbf /Y xcopy I:\DATA\Nws\openshop.dbf I:\Machine Department\datafiles\openshop.dbf /Y xcopy I:\DATA\Nws\invhist.dbf I:\Machine Department\datafiles\invhist.dbf /Y xcopy I:\DATA\Nws\foggrout.dbf I:\Machine Department\datafiles\foggrout.dbf /Y xcopy I:\DATA\Nws\oorddetl.dbf I:\Machine Department\datafiles\oorddetl.dbf /Y xcopy I:\DATA\Nws\rthist.dbf I:\Machine Department\datafiles\rthist.dbf /Y
I'm unsure of the benefit of using the if statement or why it is necessary to use a separate window.
Good luck.
Quote Yes I do and here is the bat file I worte and it doesn't work Next time try to be more specific as to what went wrong. "it doesn't work" is not helpful at all.Quote@echo off if .%RunIFWTask%==. set RunIFWTask=1 & start "Image for Windows" /min %SystemRoot%\system32\cmd.exe /c "%0" & goto :EOF xcopy "I:\DATA\Nws\inventry.dbf" "I:\Machine Department\datafiles\inventry.dbf" /Y xcopy "I:\DATA\Nws\openshop.dbf" "I:\Machine Department\datafiles\openshop.dbf" /Y xcopy "I:\DATA\Nws\invhist.dbf" "I:\Machine Department\datafiles\invhist.dbf" /Y xcopy "I:\DATA\Nws\foggrout.dbf" "I:\Machine Department\datafiles\foggrout.dbf" /Y xcopy "I:\DATA\Nws\oorddetl.dbf" "I:\Machine Department\datafiles\oorddetl.dbf" /Y xcopy "I:\DATA\Nws\rthist.dbf" "I:\Machine Department\datafiles\rthist.dbf" /Y Or maybe it just needs some quotes?The quotes were the problem. I ADDED a pause in it so I could see why it didn't work - so sorry to sidewinder for not going into more detail. First time using this forum so next time I will give all more info. Thanks to all for your help
|