in reply to Environmental Variables

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

Replies are listed 'Best First'.
Re^2: Environmental Variables
by Mounty (Initiate) on Nov 23, 2006 at 12:27 UTC
    Thanks for that, I ended up with an even simpler soloution. I just added a:

    SET PATH="...."

    As the first line of the .bat. As the file isn't going anywhere any time soon i think it should be ok.

    Luckly there are a set number (5) of hooks that can be implemented, so thay all now have .bat files pointing at Perl scripts.

    Thanks again for your help

    M