topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday December 13, 2024, 11:51 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Allowed Characters in Windows Environment Variable Names  (Read 6173 times)

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Does any one have any pointers to references regarding the allowed characters in Windows Environment Variable names?

I found the following for *nix:

  Allowed characters in linux environment variable names

MSDN has:

The name of an environment variable cannot include an equal sign (=).

Was hoping to find something that spelled things out a bit more...

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,629
    • View Profile
    • Donate to Member
Re: Allowed Characters in Windows Environment Variable Names
« Reply #1 on: May 21, 2011, 06:42 AM »
Though Windows seems to support Unicode environment variables, not all applications support them, and probably wont get that support until they are 'upgraded' to support Unicode from the ground up 8).

Any time I've had to define my own, I sticked with plain ascii characters a-z and 0-9, and sometimes an '_', anything else could turn up problematic in a batch file (where I use environment vars primarily).

If it's for use in your own application, and you want users to set them from the standard Windows configuration screens, I'd stick with things typable on a standard US keyboard, or else the instructions to set them could be awkward, at least.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Allowed Characters in Windows Environment Variable Names
« Reply #2 on: May 23, 2011, 03:34 AM »
Thanks for the response.

I'm trying to write a small wrapper program to launch other programs and would like to be able to configure it via some simple settings file.  I'd like to be able to specify environment variable name and value pairs in the settings file and as a part of that I'd like to check the specific name, value pairs -- I'd prefer not to blindly take what's been specified and pass them on to a function to modify environment variables...

I tend to stick to alphanumeric plus underscore, but I notice via experimentation that other things seem to work.  Perhaps for initial versions I'll stay on the strict side.