Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using xcopy to rename a file 1

Status
Not open for further replies.
Jun 18, 2001
84
US
Hi - trying to write a script using xcopy. one of the things i want to do is copy a file to another directory and have it rename the file. so, for example, i got file123.exe in c:\temp. i want to copy the file to c:\temp2 and rename it to setup.exe.

problem is the numbers in the file name changes every day, so it might be file123, file987, file 456, etc.

here's the xcopy command i want to run:
xcopy c:\temp\file*.exe c:\temp2\setup.exe

xcopy always comes up with the following prompt when it runs the file:
Does C:\test2\setup.exe specify a file name
or directory name on the target
(F = file, D = directory)?

it will not copy and rename the file until i hit "F". this script runs at 1AM so i want it to automtically know that this is a file w/o having to hit F.

Anyone know how i can bypass this? Thanks!
 
in the directory c:\temp create another file called f.txt. inside that file put a single character f
change you command script to read &quot;xcopy c:\temp\file*.txt c:\temp2\setup.exe <f.txt&quot;

This will enter f whenever a prompt is presented.

N
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top