- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
cmd /c "-6ren">
我的 QProcess 遇到了非常奇怪的问题,而且它的行为很奇怪。
我最终想要得到的是这样的东西(这是Windows 7中的cmd.exe)
C:\path_to_somewhere>cmd /c "C:\Program Files\path_to_dir\executable"
(cmd是为了兼容QProcess的显示)
所以为了做类似的事情,我创建了这个:
QProcess proc;
QString command;
QStringList attributes;
command = "c:\\windows\\system32\\cmd.exe";
QStringList << QString("/c \"C:\\Program Files\\path_to-dir\\executable"");
proc.start(command, attributes);
我得到的错误输出是:
Name '\"c:\Program Files\Quantum GIS Wroclaw\bin\gdalwarp.exe\"' is not recognized as
internat or external command, executable or batch file.
(这是我从波兰语翻译过来的,所以英语可能有点不同)。
似乎\字符在字符串中没有转义,而将\"作为命令中的字符。我做错了什么?
我已经尝试过
proces.start(QString)
具有三重“\”\”的函数,它也不起作用。我想这个问题的解决方案必须非常简单,我什至都没有想到它。
最佳答案
好吧,我不知道这是否是 Qt 错误,但在关于 void QProcess::start(QString, QStringList, OpenMode)
的文档中据说是这样的:
Windows: Arguments that contain spaces are wrapped in quotes.
似乎这不是真的,因为我的程序使用带有空格的路径,并且 cmd shell 在那里中断。
但是,我发现该函数是为仅接受一个字符串参数的系统设计的(就像 Windows 那样)。
这是 QProcess::setNativeArguments(QString)
接受一个 QString 作为参数,专为 Windows 和 Symbian 创建。
毕竟,如果有人在将 Windows(或 Symbian)中的参数传递到系统时遇到问题,他应该尝试 setNativeArguments(QString)
。
关于escaping - QProcess 和命令行 "/c"参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12769321/
一个简单的GNU m4问题,但是我找不到正确的答案。我想在代码部分的开始/结束处打印一个markdown header : ``` echo Hello ``` 如何创建包含3个反引号的GNU M4宏
我有一个 shell 变量(我们将调用 x),其中包含一个带有 shell 元字符的字符串。例如,我可能有 abc "def's" ghi 设置为 x='abc "def'\''s" ghi'
我有一个 shell 变量(我们将调用 x),其中包含一个带有 shell 元字符的字符串。例如,我可能有 abc "def's" ghi 设置为 x='abc "def'\''s" ghi'
执行以下行时: df = df[df['Directory'].str.contains("C:\Windows\System32\Tasks")] 我收到以下错误: File "/Users/pat
我正在使用 python-social-auth 从我的 Django 应用程序登录社交网络。在我的本地机器上一切正常,但是当我部署到服务器时出现以下错误: oauthlib.oauth1.rfc58
URI.escape 和 CGI.escape 有什么区别,我应该使用哪一个? 最佳答案 斧头和剑有什么区别,我应该使用哪一种?好吧,这取决于您需要做什么。 URI.escape 应该将字符串 (UR
我今天安装了 Zenwalk Linux。我发现 Escape 键没有绑定(bind)到任何东西(至少据我所知),而是 Escape 通常会做什么(关闭程序,打开 vim 命令行等)Shift-Esc
我遇到过一种情况,闭包可能在函数 f1 内部调用(闭包被传递到其中),或者可能会传递给其他函数 f2 >。 所以现在我想知道应该如何定义这个闭包的转义行为。我的意思是我应该放 @escaping 还是
在 js/jQuery 中有没有办法拥有这两种按键组合? ESCape 键 和 SHIFT + ESCape 键 当我实现它时使用: document.onkeydown = function(e){
我正在尝试将字符串中的任何换行符或转义换行符规范化为转义的 unix 换行符。我不明白为什么这不起作用: Pattern EOL = Pattern.compile("(\\\\r)?\\\\n|\r
swift 4.2,Xcode 10.1 在我正在处理的订单处理应用程序中,用户可以搜索已处理或提交的订单。发生这种情况时,它将检查是否有订单缓存,如果没有,它将使用异步 API 请求重新填充该缓存,
我的几个网页名称中包含以下字符&,例如“Shipping & Deliveries”等 我的架构标记注入(inject)了 GTM (JSON-LD),但在 SDTT 中我收到以下错误: Uncate
自版本 1.9.0 起,Twig为 escape 过滤器提供 html_attr 策略(参见 documentation )。 html 策略使用 htmlspecialchars PHP 函数(通过
我有一个像这样的 View Controller : class PublicationListViewController: UIViewController { var publicati
这是我的代码: class Main { init() { let x = Sub(s: foo) } func foo(completion: @escapi
我正在尝试将闭包用于一阶谓词演算,并且我打算定义以下函数: func ASSUM(p: @escaping Pred) -> (Pred) -> Pred { return { q in AN
我有关于 ezSQL_mysql 和 ezSQLcore 的问题,它可能是 PHP 版本不兼容,我分享下面的代码。我应该使用什么版本的 PHP 或者我应该做什么来定制 mysqli? (我的PHP版本
我有以下函数,其中有完成处理程序,但出现此错误: Closure use of non-escaping parameter may allow it to escape 这是我的代码: func m
我正在使用 Swift-VectorBoolean 库,它目前在 Swift 3.2 上,尚未针对 Swift 4.2 进行更新,但应该仍可在 Xcode 10 上运行。在 Xcode 9 上运行它,
我想用这个 ansible 命令在 nrpe.cfg 中插入一个 nrpe 命令 check_tomcat_threads.pl -H localhost -p 30011 -C '"http-bio
我是一名优秀的程序员,十分优秀!