Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

bart (450)

Journal of bart (450)

Tuesday March 02, 2010
09:26 AM

Headsup on command line for shortcuts in Windows XP

[ #40219 ]

For Strawberry Perl, and Padre, I use a custom entry in the Start Menu, which technically is a shortcut (*.LNK file). For example, for Padre the command line in the shortcut file was:

C:\WINDOWS\system32\cmd.exe /c PATH=c:\strawberry\perl\bin;c:\strawberry\c\bin;%PATH% && padre

Likewise, the command line for my Strawberry shell was:

C:\WINDOWS\system32\cmd.exe /k PATH=c:\strawberry\perl\bin;c:\strawberry\c\bin;%PATH%

Overnight, these both stopped working.

After a bit of puzzling, I figured out that a new program had been installed by Windows Update, and this had added a new directory to PATH. As a result, after the environment variable was substituted with its real value, the length of the expanded command line was now longer than 256 bytes, and now PATH got truncated.

Remember, folks:

The length of the command line for a shortcut, after expansion, should never be longer than 256 bytes.

If you put the code for modification of PATH in a *.BAT file, no such restriction applies.

So now, my shortcut to start the command shell is:

C:\WINDOWS\system32\cmd.exe /k c:\strawberry\strawberry_path.bat

where c:\strawberry\strawberry_path.bat contains the lines

@echo off
PATH=C:\strawberry\c\bin;C:\strawberry\perl\bin;%PATH%

which makes it easier for me to add more Perl based tools that depend on these entries in PATH: I now have a central location for the definition, if I ever need to add or modify a directory.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.