简体   繁体   English

字符串中的自动热键转义引号(用于运行命令参数)

[英]Autohotkey escape quotes in string (for Run command arguments)

I'm trying to pass arguments to a windows command via autohotkey, but I haven't been able to successfully escape quotes in the string. 我正在尝试通过autohotkey将参数传递给Windows命令,但无法成功转义字符串中的引号。

I want to do something like: Run, shutdown "/s /c /"MESSAGE/"" 我想做类似的事情:运行,关闭“ / s / c /” MESSAGE /“”

So I run the command: shutdown /s /c "MESSAGE" 所以我运行命令:shutdown / s / c“ MESSAGE”

How do I do this? 我该怎么做呢?

Double up the quotes to escape them. 加倍报价以转义它们。

Run, shutdown "/s /c ""MESSAGE"""

See the EscapeChar documentation for more information. 有关更多信息,请参见EscapeChar文档。

The forward slash is not an escape key so you don't need to escape it, if you have problems put curly braces around it like : shutdown {/}f {/}r {/}t 00 {Enter} but it should work (and does on my machine) without curly braces. 正斜杠不是转义键,因此,如果遇到问题,则无需转义,例如: shutdown {/}f {/}r {/}t 00 {Enter}但它应该起作用(并且在我的计算机上使用)没有大括号。 The quotes can also be done inside curly braces. 引号也可以在花括号内完成。 So: shutdown /s /c {"}MESSAGE{"} should work. 因此: shutdown /s /c {"}MESSAGE{"}应该可以工作。

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

相关问题 在 powershell -Command 中转义双引号 - Escape double quotes in powershell -Command AutoHotKey 的“%UserInput%”功能是否存在严重错误? 它没有逃脱,或者似乎让我逃脱,双引号 - Does AutoHotKey's "%UserInput%" feature have a critical bug? It doesn't escape, or seem to allow me to escape, double quotes 如何在命令行 to.vbs 脚本上转义双引号? - How can I escape double quotes on command line to .vbs script? 如何在包含引号(“”)的批处理文件中运行命令? - How to run a command in a batch file that contains quotes ( “” )? 如何使用 Cmder 命令行 arguments 创建启动脚本 (iebat) 的 AutoHotKey? - How to create AutoHotKey which starts script (i.e .bat) using Cmder command line arguments? PowerShell 从命令行中去除双引号 arguments - PowerShell stripping double quotes from command line arguments 传递参数时使用DOS启动命令有引号 - using the DOS start command when passed arguments have quotes Java - 带有空格和双引号的 ProcessBuilder 命令参数失败 - Java - ProcessBuilder command arguments with spaces and double-quotes fails Perl 命令行:目录 arguments 的单引号和双引号 - Perl command line: single vs. double quotes for directory arguments Python Subprocess.Run 将转义字符插入程序 arguments - Python Subprocess.Run inserting escape characters into program arguments
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM