shift.ex2
来自「linux下查找文件的方法,对于初学者来说很有用,仅供参考」· EX2 代码 · 共 41 行
EX2
41 行
SHIFT─例子
下面的批处理文件MYCOPY.BAT说明怎样用SHIFT命令处理任意多个命令行参
数,将一系列文件拷贝到一个指定的目录。使用的参数是目录名和后面的一系
列文件名。
@echo off
rem MYCOPY.BAT copies any number of files
rem to a directory.
rem The command uses the following syntax:
rem mycopy dir file1 file2 ...
set todir=%1
:getfile
shift
if "%1"=="" goto end
copy %1 %todir%
~w
goto getfile
:end
set todir=
echo All done
? @echo off
? rem MYCOPY.BAT copies any number of files
? rem to a directory.
? rem The command uses the following syntax:
? rem mycopy dir file1 file2 ...
? set todir=%1
? :getfile
? shift
? if "%1"=="" goto end
? copy %1 %todir%
? goto getfile
? :end
? set todir=
? echo All done
~w
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?