"F:\- Big Packets -\kitterengine\Common\Template.bat" 可能以call 开头(参见call /?)。或Cd /d "F:\- Big Packets -\kitterengine\Common\" & Template.bat。
CMD 备忘单
Cmd.exe
获得帮助
标点符号
命名文件
启动程序
按键
CMD.exe
首先要记住它是一种操作计算机的方式。这是我们在 WIMP(Windows、图标、鼠标、弹出菜单)变得普遍之前所做的方式。它源于 CPM、VMS 和 Unix。它用于启动程序以及复制和删除文件。您也可以更改时间和日期。
有关启动 CMD 的帮助,请键入 cmd /?。您必须使用 /k 或 /c 开关启动它,除非您只想输入它。
获得帮助
一般帮助。在命令提示符下键入Help。对于列出的每个命令,键入help <command>(例如help dir)或<command> /?(例如dir /?)。
有些命令有子命令。例如schtasks /create /?。
NET 命令的帮助不寻常。键入 net use /? 是简短的帮助。键入net help use 以获得全面帮助。这同样适用于根目录 - net /? 也是简要帮助,请使用 net help。
帮助中对新行为的引用描述了从 OS/2 和 Windows NT4 中的 CMD 到 Windows 2000 及更高版本中的当前 CMD 的变化。
WMIC 是一个多用途命令。输入wmic /?。
标点符号
& seperates commands on a line.
&& executes this command only if previous command's errorlevel is 0.
|| (not used above) executes this command only if previous command's
errorlevel is NOT 0
> output to a file
>> append output to a file
< input from a file
2> Redirects command error output to the file specified. (0 is StdInput, 1 is StdOutput, and 2 is StdError)
2>&1 Redirects command error output to the same location as command output.
| output of one command into the input of another command
^ escapes any of the above, including itself, if needed to be passed
to a program
" parameters with spaces must be enclosed in quotes
+ used with copy to concatenate files. E.G. copy file1+file2 newfile
, used with copy to indicate missing parameters. This updates the files
modified date. E.G. copy /b file1,,
%variablename% a inbuilt or user set environmental variable
!variablename! a user set environmental variable expanded at execution
time, turned with SelLocal EnableDelayedExpansion command
%<number> (%1) the nth command line parameter passed to a batch file. %0
is the batchfile's name.
%* (%*) the entire command line.
%CMDCMDLINE% - expands to the original command line that invoked the
Command Processor (from set /?).
%<a letter> or %%<a letter> (%A or %%A) the variable in a for loop.
Single % sign at command prompt and double % sign in a batch file.
\\ (\\servername\sharename\folder\file.ext) access files and folders via UNC naming.
: (win.ini:streamname) accesses an alternative steam. Also separates drive from rest of path.
. (win.ini) the LAST dot in a file path separates the name from extension
. (dir .\*.txt) the current directory
.. (cd ..) the parent directory
\\?\ (\\?\c:\windows\win.ini) When a file path is prefixed with \\?\ filename checks are turned off.
命名文件
< > : " / \ | Reserved characters. May not be used in filenames.
Reserved names. These refer to devices eg,
copy filename con
which copies a file to the console window.
CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4,
COM5, COM6, COM7, COM8, COM9, LPT1, LPT2,
LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9
CONIN$, CONOUT$, CONERR$
--------------------------------
Maximum path length 260 characters
Maximum path length (\\?\) 32,767 characters (approx - some rare characters use 2 characters of storage)
Maximum filename length 255 characters
启动程序
请参阅 start /? 和 call /? 以获取所有三种方式的帮助。
有两种类型的 Windows 程序 - 控制台或非控制台(即使它们没有,也称为 GUI)。控制台程序附加到当前控制台或 Windows 创建一个新控制台。 GUI 程序必须明确创建自己的窗口。
如果没有给出完整路径,则 Windows 会查找
加载应用程序的目录。
父进程的当前目录。
Windows NT/2000/XP:32 位 Windows 系统目录。使用
GetSystemDirectory 函数获取此目录的路径。这
此目录的名称是 System32。
Windows NT/2000/XP:16 位 Windows 系统目录。没有
获取此目录的路径的函数,但它是
搜索。此目录的名称是 System.
Windows 目录。使用 GetWindowsDirectory 函数获取
此目录的路径。
PATH 环境变量中列出的目录。
指定程序名称
这是启动程序的标准方式。
c:\windows\notepad.exe
在批处理文件中,批处理将等待程序退出。什么时候
键入命令提示符不等待图形
程序退出。
如果程序是一个批处理文件控制被转移,调用批处理文件的其余部分不被执行。
使用启动命令
Start 以非标准方式启动程序。
start "" c:\windows\notepad.exe
Start 启动程序并且不等待。控制台程序在新窗口中启动。使用/b 开关强制控制台程序进入同一个窗口,这否定了 Start 的主要目的。
开始使用 Windows 图形外壳 - 与键入 WinKey + R(运行对话框)相同。试试
start shell:cache
在HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths 下注册的程序名称也可以在不指定完整路径的情况下键入。
还要注意第一组引号,如果有的话,必须是窗口标题。
使用调用命令
调用用于启动批处理文件并等待它们退出并继续当前批处理文件。
其他文件名
键入非程序文件名与双击文件相同。
按键
Ctrl + C 退出程序而不退出控制台窗口。
对于其他编辑键,请键入 Doskey /?。
↑ 和 ↓ 调用命令
ESC 清除命令行
F7 显示命令历史记录
ALT+F7 清除命令历史记录
F8 搜索命令历史记录
F9按数字选择命令
ALT+F10 清除宏定义
也未列出
Ctrl + ←或→一次移动一个单词
Ctrl + Backspace 删除前一个单词
首页行首
End行尾
Ctrl + End删除到行尾