启动程序
看到开始/?并调用 /?寻求所有三种方式的帮助。
指定程序名称
c:\windows\notepad.exe
在批处理文件中,批处理将等待程序退出。什么时候
键入命令提示符不等待图形
程序退出。
如果程序是一个批处理文件控制被转移,调用批处理文件的其余部分不被执行。
使用启动命令
start "" c:\windows\notepad.exe
Start 启动一个程序并且不等待。控制台程序在新窗口中启动。使用 /b 开关强制控制台程序进入同一窗口,这否定了 Start 的主要目的。
开始使用 Windows 图形外壳 - 与键入 WinKey + R(运行对话框)相同。试试
start shell:cache
还要注意第一组引号,如果有的话,必须是窗口标题。
使用调用命令
调用用于启动批处理文件并等待它们退出并继续当前的批处理文件。
参考Start,只需输入程序名称。
帮助 Windows 查找程序和文档
可以将程序和文档添加到注册表中,以便在“开始 - 运行”对话框或快捷方式中输入它们的名称而不输入它们的路径,这样 Windows 就可以找到它们。
REGEDIT4
;The bolded name below is the name of the document or program, <filename>.<file extension>
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\IE.txt]
;The @ means the path to the file is assigned to the default value for the key.
;The whole path in enclosed in a quotation mark ".
@="\"C:\\Program Files\\Internet Explorer\\IE.txt\""
;Optional Parameters. The semicolon means don't process the line. Remove it if you want to put it in the registry
;Informs the shell that the program accepts URLs.
;"useURL"="1"
;Sets the path that a program will use as its' default directory. This is commented out.
;"Path"="C:\\Program Files\\Microsoft Office\\Office\\"
技术讨论。
CMD 预处理命令并找到文件然后调用CreateProcess。开始 - 运行对话框或Start 命令使用ShellExecuteEx,最终调用CreateProcess。
这是 CreateProcess 规则 - 注意 CMD 提供到 CreateProcess 的完整路径。 https://msdn.microsoft.com/en-us/library/ms682425
1.加载应用程序的目录。
2.父进程的当前目录。
3.32位Windows系统目录。使用GetSystemDirectory函数获取该目录的路径。
- 16 位 Windows 系统目录。没有函数获取这个目录的路径,但是被搜索了。此目录的名称是 System。
5.Windows 目录。使用 GetWindowsDirectory 函数获取该目录的路径。
6.PATH 环境变量中列出的目录。请注意,此函数不会搜索 App Paths 注册表项指定的每个应用程序路径。要在搜索序列中包含此每个应用程序路径,请使用 ShellExecute 函数。
ShellExecuteEx 在这里https://msdn.microsoft.com/en-us/library/bb759784(v=vs.85).aspx
我的 Skydrive 上提供了 CMD 预处理 - 最初来自 MS 网站,但没有更多。请参阅 Windows NT 命令外壳 Ch 2 https://1drv.ms/f/s!AvqkaKIXzvDieQFjUcKneSZhDjw