Saturday, December 31, 2005

Accessing Windows Environment Variables from Windows Explorer

Windows Explorer helpfully allows access to Windows environment variables by parsing strings surrounded by percentage characters (%). For example, if you want to find the current user profile folder type %userprofile% into the Windows explorer address bar and the relevant folder will be opened.

This extends to files. If you have a file that you regularly need access to from within Windows Explorer then adding it to the environment variables means that when you invoke its name within percentage marks it will be opened.

I have a number of user profiles that i use depending on what network I'm logged onto but as I only have one Things To Do list I'm always accessing that file so I have added it as an environment variable %TTD%.

If you have autocomplete switched on then entering a % mark will give you a list of used environment variables to pick from.

You can find how to set autocomplete on in Windows Explorer here.

Just to get you going here are some of the more useful environment variables that resolve to file locations on my machine:

The ones I use most from this list I suppose are %comspec%, %temp% and %userprofile%

%allusersprofile%
%appdata%
%commonprogramfiles%
%comspec%
%homepath%
%homedrive%
%include%
%lib%
%logonserver%
%netsamplepath%
%programfiles%
%systemroot%
%vs71cmntools%
%windir%

1 comment:

Matthew Pass said...

...don't forget %temp%, which I find really handy.