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

时间:2022-02-01 23:16:47

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. The edited script looks like this:

编辑:当我使用start命令时,它会打开一个新的shell,其中包含我输入的字符串作为标题。编辑过的脚本如下所示:

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"

3 个解决方案

#1


9  

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"

#2


4  

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. Adding the "" makes it see your path as the program to run.

当您的路径用引号括起来时,START会将其解释为窗口的标题。添加“”会使您将路径视为要运行的程序。

#3


2  

There is the start command that will behave much like if you clicked the files in Explorer.

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

#1


9  

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"

#2


4  

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. Adding the "" makes it see your path as the program to run.

当您的路径用引号括起来时,START会将其解释为窗口的标题。添加“”会使您将路径视为要运行的程序。

#3


2  

There is the start command that will behave much like if you clicked the files in Explorer.

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