Inno Setup, spaces and double quotes in [Run]

I am trying to schedule a task on Windows, and unfortunately it does not work! The task is created, but not correctly.

When I look through the task parameters, it says:

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

This is how I continue:

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

And I do not know why this does not work, double quotes should fix the problem of "spaces"

Any ideas?

+4
source share
2 answers

This problem is known and described in this knowledge base article. You will need to enclose the file name between the combination of backslash and quotation marks. This article describes:

Cause:

, . , , Schtasks.exe:

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

:

, ( ) (\) ( "), \". ( ) , , .

, :

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

, , , :

 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}\""";
+5

, , SO-, /TR,

Parameters: "/create /tn TaskName /sc MINUTE /mo 10 /tr '"{app}\{#MyAppExeName}"'";

, .

0

Source: https://habr.com/ru/post/1540238/


All Articles