如何在cmd start中使用引号? [英] How do I use quotes in cmd start?

查看:329
本文介绍了如何在cmd start中使用引号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我想做的事情。

start /wait ((c:\Program Files\NetDrive2\nd2cmd.exe) -c m -t ftp -blabla)

如果我这样做

start /wait "c:\Program Files\NetDrive2\nd2cmd.exe -c m -t ftp -blabla"

然后出现错误,因为程序文件具有空格。

Then there is an error because "Program Files" has a space.

如果我愿意

start /wait "c:\Program Files\NetDrive2\nd2cmd.exe" -c m -t ftp -blabla

然后它解释 start的参数,因此也会产生错误。

Then it interprets the argument for start so it also generates an error.

在普通程序语言中,是否存在像方括号这样的方程式重叠?

Is there anyway to overlap the equation like bracket in normal program language?

推荐答案

参考开始-启动程序,命令或批处理脚本(在新窗口中打开。)


语法

开始" title&q ot [/ D路径] [选项]命令 [参数]

标题 CMD窗口标题栏的文本(必需。)

title Text for the CMD window title bar (required.)

路径起始目录。

命令要运行的命令,批处理文件或可执行程序。

command The command, batch file or executable program to run.

参数传递给命令的参数。

...


总是包含一个 TITLE ,它可以是一个简单的字符串,例如 My Script。或只是一对空引号。根据Microsoft文档,标题是可选的,但是如果省略标题,您可能会遇到问题。

Always include a TITLE this can be a simple string like "My Script" or just a pair of empty quotes "". According to the Microsoft documentation, the title is optional, but you may will have problems if it is omitted.

如果<$省略c $ c> title 是因为第一个 字符(如果存在)将用于分隔标题,因此开始将把程序文件 解释为标题。

The reason you have an error if title is omitted is because the first " character (if present) will be used to delimit the title, so start will interpret "Program Files" as a title.

如果没有字符和 title 可以省略。

If there are no " characters then title can be omitted.

您的命令应该看起来像像这样:

Your command should look like:

start /wait "My title" "c:\Program Files\NetDrive2\nd2cmd.exe" -c m -t ftp -blabla

这篇关于如何在cmd start中使用引号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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