I'm trying to create a self-contained chocolatey package containing a .bat file (i.e. my "executable") that I want to shim onto the path. My chocolateyinstall.ps1
file consists of the following:
$ErrorActionPreference = 'Stop'; # stop on all errors
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
Install-BinFile -Name 'test.bat' -Path $toolsDir
This creates the file test.bat.exe
when the package is installed. But when I run the .exe file I get the error:
Cannot find file at '..\lib\test-pkg\tools' (C:\ProgramData\chocolatey\lib\test-pkg\tools). This usually indicates a missing or moved file.
The directory mentioned (C:\ProgramData\chocolatey\lib\test-pkg\tools
) definitely exists and contains the test.bat
file, so the packaging and installation of the .bat file worked. As such, it looks to be a problem with the shim?
By way of experiment, I tried to shim a .ps1
Powershell script in the same way, and got the same error message.
What am I missing here? Thanks!