简体   繁体   English

运行Windows批处理脚本以启动多个文件

[英]Running a Windows Batch Script to Startup Multiple Files

I'm trying to replace the programs that run from my startup directory with a batch script. 我正在尝试用批处理脚本替换从我的启动目录运行的程序。 The batch script will simply warn me that the programs are going to run and I can either continue running the script or stop it. 批处理脚本只会警告我程序将运行,我可以继续运行脚本或停止它。

Here's the script as I have written so far: 这是我到目前为止编写的脚本:

@echo off
echo You are about to run startup programs!
pause 

::load outlook
cmd /k "C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE" /recycle
::load Visual Studio 2008
call "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"

Both of these commands will load the first program and wait until I close it to load the second. 这两个命令都将加载第一个程序并等到我关闭它以加载第二个程序。 I want the script to load the processes simultaneously. 我希望脚本同时加载进程。 How do I accomplish this? 我该如何做到这一点?

Edit: When I use the start command it opens up a new shell with the string that I typed in as the title. 编辑:当我使用start命令时,它会打开一个新的shell,其中包含我输入的字符串作为标题。 The edited script looks like this: 编辑后的脚本如下所示:

start  "C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE"
::load Visual Studio 2008
start "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"

This works: 这有效:

@echo off
echo You are about to run startup programs!
pause 

::load outlook
start /b "" "C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE" /recycle
::load Visual Studio 2008
start /b "" "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"

Use START like this: 像这样使用START:

START "" "C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE"

When your path is enclosed in quotes, START interprets it as the title for the window. 当您的路径用引号括起来时,START会将其解释为窗口的标题。 Adding the "" makes it see your path as the program to run. 添加“”会使其将路径视为要运行的程序。

如果在资源管理器中单击文件,则会有一个start命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM