问题
I am using the below batch script to copy the files from current folder to the specified location.
@echo off
echo copying files to destination
copy *.eps* \\10.10.14.13\adman\in\displ )
I am facing 2 problems in the above script.
I am not able to select a particular file and run the script, for e.g if the folder got more (eps) files it copies all the files to the location.
I want to insert my user login name at the end of the each copied file.
My file name look like F0#CGDBANG000947532#.eps
and I want like this F0#CGDBANG000947532#username.eps
.
回答1:
copy "*.eps*" "\\10.10.14.13\adman\in\displ\*%username%.*"
Try ForFiles /?
, For /?
, xcopy /?
, and robocopy /?
for how to select files on different critera.
回答2:
finally, after some of your comments here and in your other question, I understood your request (I think).
@echo off
for %%i in (%*) do if /i "%%~xi"==".eps" copy "%%i" "\\10.10.14.13\adman\in\displ\%%~ni%username%.%%~xi"
pause
来源:https://stackoverflow.com/questions/23847967/batch-script-file-name