Computing.Net > Forums > Disk Operating System > Batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch file

Reply to Message Icon

Name: Matt
Date: April 2, 2001 at 10:51:45 Pacific
Comment:

I need to write a batch file that will search the hard drive for a file and if it exists, overwrite it with a specified file. The file could be in different locations on different computers, so hard coding an "xcopy" statement in the batch file is impossible. Help, please!



Sponsored Link
Ads by Google

Response Number 1
Name: Terry
Date: April 4, 2001 at 17:29:23 Pacific
Reply:

you will have to hard code each path that you want to search, depending on how many drives, and paths, this could be alot of code.

It will look something like this:

location = C:\path1
:START
if exist %location%(filename) goto work
'rem, this variable resetting works from
the bottem up.

if %location%==d:\path2 set location=d:\path3
if %location%==d:\path1 set location=d:\path2
if %location%==c:\path2 set location=d:\path1
if %location%==c:\path1 set location=c:\path2
goto START
:work
copy (filename1) %location% (filename)



0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Batch file

Help!! Batch File www.computing.net/answers/dos/help-batch-file/13525.html

Batch files - - Mapping network drive www.computing.net/answers/dos/batch-files-mapping-network-drive/3809.html

Pause batch file www.computing.net/answers/dos/pause-batch-file/2810.html