Skip to content

Commit

Permalink
(chocolateyGH-1067) Add elevated cmd example
Browse files Browse the repository at this point in the history
Having seen many packages with their calls written in a fragile manner and having perpetuated/contributed to some of the mess, I figured maybe I should offer a better example as penance.
  • Loading branch information
dragon788 authored Nov 30, 2016
1 parent c7a854f commit 2ad2cf1
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -173,4 +178,4 @@ public class ChocolateyInstallTemplate
#{{ChecksumTypex64}} - The checksum type for the 64-bit url | /ct64
";
}
}
}

0 comments on commit 2ad2cf1

Please sign in to comment.