Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save The-Running-Dev/e037ca6fd92a5e6a7d690cf32b18f6d8 to your computer and use it in GitHub Desktop.
Save The-Running-Dev/e037ca6fd92a5e6a7d690cf32b18f6d8 to your computer and use it in GitHub Desktop.
# You will find this at the top of the ChocolateyInstall.ps when you run ```choco new PackageName```
cd Drive:\Path\To\PackageName\tools
# Get the full path to the install script
$f = Join-Path -Resolve . .\chocolateyinstall.ps1
# Do some search and repalce to remove all the contents
gc $f | ? {$_ -notmatch "^\s*#"} | % {$_ -replace '(^.*?)\s*?[^``]#.*','$1'} | Out-File $f+".~" -en utf8; mv -fo $f+".~" $f
# This will be the result, I've commented it out here to show it
<#
$ErrorActionPreference = 'Stop';
$packageName= 'Sample'
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$url = ''
$url64 = ''
$packageArgs = @{
packageName = $packageName
unzipLocation = $toolsDir
fileType = 'EXE_MSI_OR_MSU'
url = $url
url64bit = $url64
softwareName = 'Sample*'
checksum = ''
checksumType = 'sha256'
checksum64 = ''
checksumType64= 'sha256'
silentArgs = "/qn /norestart /l*v `"$($env:TEMP)\$($packageName).$($env:chocolateyPackageVersion).MsiInstall.log`""
validExitCodes= @(0, 3010, 1641)
}
Install-ChocolateyPackage @packageArgs
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment