BAT批处理 - doranbai/Note GitHub Wiki

注释

rem和::

回显

echo on/off
@@字符放在命令前将关闭该命令回显,无论此时echo是否为打开状态。

errorlevel

程序返回码 echo %errorlevel% 每个命令运行结束,可以用这个命令行格式查看返回码 用于判断刚才的命令是否执行成功 默认值为0,一般命令执行出错会设 errorlevel 为1

自定义变量

set var=我是值 echo %var%

条件

if exist filename (del filename) else (echo filename missing)

注册表

“Folder” is the progid for any shell folder. It could be a virtual folder (like Control Panel) or a file system folder (like C:\WINDOWS).
“Directory” is the progid for file system folders. This is a subset of “Folder”.
“*” is the progid for all files. Doesn’t matter what the extension is.
“.” (that’s a single period) is the progid for files without any extension.
“AllFileSystemObjects” is the union of “*” and “Directory”. It is the progid for all files and for file system directories.