Then you need to set up the proper environment from within your .bat file, or have a multilevel setup that first sets up the environment and then calls your Perl script. If you are on Windows 2000 or XP, the cmd.exe shell has the facilities to help you there. Suppose you have a .cmd file that sets up your environment, then you can either hardcode the path to in your commit hook or put that environment file into a fixed directory relative to your commit hook and then call it as necessary:
@echo off
CALL C:\hardcoded\path\to\env_setup.cmd
CALL C:\hardcoded\path\to\your\commit_hook.cmd
@rem or even
perl -w c:\hardcoded\path\to\your\commit_hook.pl
@rem assuming that env_setup.cmd sets up $ENV{PATH} to include Perl.ex
+e
If your env_setup.cmd, commit_hook.cmd and perl.exe all live in directories that can be navigated relatively, I recommend the following approach:
@echo off
@rem Change into the directory where this file resides
cd /d "%~dp0"
call setup_env.cmd
perl -w your\commit_hook.pl
|