gpt4 book ai didi

inno-setup - Inno Setup,[Run] 中的空格和双引号

转载 作者:行者123 更新时间:2023-12-02 22:41:33 48 4
gpt4 key购买 nike

我正在尝试在 Windows 上安排任务,但不幸的是,它不起作用!任务已创建,但不正确。

当我查看任务的参数时,它说:

PROGRAM: C:\Program
ARGUMENTS: Files(x86)\AppName\executable.exe

这就是我的做法:

[Run]
Filename: "schtasks.exe"; Parameters: "/create /tn TaskName /sc MINUTE /mo 10 /tr ""{app}\{#MyAppExeName}""";

我不知道为什么它不起作用,双引号应该解决“空格问题”

有什么想法吗?

最佳答案

此问题是已知的,并在 this knowledge base article 中进行了描述。 。您需要将文件名括在反斜杠和引号的组合之间。该文章描述了:

Cause:

This problem occurs if the path of the scheduled task contains a space. For example, this problem occurs if you create a schedule for the following task by using Schtasks.exe:

 "c:\foldername containing spaces\task.bat"

Workaround:

To work around this problem, enclose the path portion of the task (not including arguments or switches) between backslash (\) and quotation marks (") character combinations, for example \". Enclose the complete path of the task (including arguments or switches) between quotation marks as usual when you create a path or command that contains spaces.

For example, the following example task does not run when you schedule it:

 schtasks /create /tn "my task" /tr "c:\foldername containing spaces\script.bat arguments" /sc once /sd 07/29/2003 /st 10:01

However, when you enclose the path of the task between the backslash and quotation marks character combinations as in the following example, the scheduled task runs successfully:

 schtasks /create /tn "my task" /tr "\"c:\foldername name containing spaces\script.bat\" arguments" /sc once /sd 07/29/2003 /st 10:01

所以在你的情况下可能是:

[Run]
Filename: "schtasks.exe"; Parameters: "/create /tn TaskName /sc MINUTE /mo 10 /tr ""\""{app}\{#MyAppExeName}\""";

关于inno-setup - Inno Setup,[Run] 中的空格和双引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23611855/

48 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com