ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Allowed Characters in Windows Environment Variable Names

(1/1)

ewemoa:
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 (=).

--- End quote ---

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

Ath:
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:
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.

Navigation

[0] Message Index

Go to full version