diff --git a/src/chocolatey/infrastructure.app/templates/ChocolateyInstallTemplate.cs b/src/chocolatey/infrastructure.app/templates/ChocolateyInstallTemplate.cs index c3b1cbb246..e1e8009d2f 100644 --- a/src/chocolatey/infrastructure.app/templates/ChocolateyInstallTemplate.cs +++ b/src/chocolatey/infrastructure.app/templates/ChocolateyInstallTemplate.cs @@ -111,6 +111,11 @@ public class ChocolateyInstallTemplate ## - https://chocolatey.org/docs/helpers-start-chocolatey-process-as-admin #Start-ChocolateyProcessAsAdmin 'STATEMENTS_TO_RUN' 'Optional_Application_If_Not_PowerShell' -validExitCodes $validExitCodes +## To avoid quoting issues, you can also assemble your -Statements in another variable and pass it in +# $appPath = "$env:ProgramFiles\appname" # Will resolve to C:\Program Files\appname +# $statementsToRun = "/C `"$appPath\bin\installservice.bat`"" +# Start-ChocolateyProcessAsAdmin $statementsToRun cmd -validExitCodes $validExitCodes + ## add specific folders to the path - any executables found in the chocolatey package ## folder will already be on the path. This is used in addition to that or for cases ## when a native installer doesn't add things to the path. @@ -173,4 +178,4 @@ public class ChocolateyInstallTemplate #{{ChecksumTypex64}} - The checksum type for the 64-bit url | /ct64 "; } -} \ No newline at end of file +}