如何使用“开始"在 Windows 中创建批处理文件带路径和带空格的命令 [英] How to create batch file in Windows using "start" with a path and command with spaces

查看:24
本文介绍了如何使用“开始"在 Windows 中创建批处理文件带路径和带空格的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个批处理文件,用于在 Windows .cmd 文件中启动多个控制台应用程序.这可以使用 start 命令来完成.

I need to create a batch file which starts multiple console applications in a Windows .cmd file. This can be done using the start command.

但是,该命令中有一个路径.我还需要传递也有空格的参数.如何做到这一点?

However, the command has a path in it. I also need to pass paramaters which have spaces as well. How to do this?

例如批处理文件

start "c:path with spacesapp.exe" param1 "param with spaces"

推荐答案

实际上,他的例子是行不通的(虽然一开始我也认为行得通).根据 Start 命令的帮助,第一个参数是新创建的命令提示符窗口的名称,第二个和第三个应该分别是应用程序及其参数的路径.如果您在应用程序路径之前添加另一个",它应该可以工作(至少对我来说是这样).使用这样的东西:

Actually, his example won't work (although at first I thought that it would, too). Based on the help for the Start command, the first parameter is the name of the newly created Command Prompt window, and the second and third should be the path to the application and its parameters, respectively. If you add another "" before path to the app, it should work (at least it did for me). Use something like this:

start "" "c:path with spacesapp.exe" param1 "param with spaces"

您可以将第一个参数更改为您希望新命令提示符的标题.如果是创建的 Windows 应用,则不会显示命令提示符,标题也无关紧要.

You can change the first argument to be whatever you want the title of the new command prompt to be. If it's a Windows app that is created, then the command prompt won't be displayed, and the title won't matter.

这篇关于如何使用“开始"在 Windows 中创建批处理文件带路径和带空格的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆