引用:
原帖由 月流霜 于 2013-10-24 10:45 发表 
简约,那如果现在做的是复制操作,原来的exe在哪个文件夹,复制后的bak也还在那个文件夹,这该如何写呢,试过
FOR /R E:MATLAB %%i IN (*.exe) DO @COPY %%i *.bak
可是这样写会在当前目录复制所有文件,求指教 ...
FOR /R c:test %I IN (*.exe) DO copy "%I" "%~npI.bak"
%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~dI - expands %I to a drive letter only
%~pI - expands %I to a path only
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
%~sI - expanded path contains short names only
%~aI - expands %I to file attributes of file
%~tI - expands %I to date/time of file
%~zI - expands %I to size of file
The modifiers can be combined to get compound results:
%~dpI - expands %I to a drive letter and path only
%~nxI - expands %I to a file name and extension only
%~fsI - expands %I to a full path name with short names only
评论