Skip to content

Instantly share code, notes, and snippets.

@lundeen-bryan
Last active February 15, 2022 03:46
Show Gist options
  • Save lundeen-bryan/9dd498aa7c747587570a0584d107b101 to your computer and use it in GitHub Desktop.
Save lundeen-bryan/9dd498aa7c747587570a0584d107b101 to your computer and use it in GitHub Desktop.
EnvironVariables
Environment Variables Values (may vary)
%ALLUSERSPROFILE% C:\ProgramData
%APPDATA% C:\Users(user-name)\AppData\Roaming
%CD% (command prompt only) Current directory full path
%CMDCMDLINE% (command prompt only) Returns exact command line used to start current cmd.exe session.
%CMDEXTVERSION% (command prompt only) Number of current command processor extensions.
%CommonProgramFiles% C:\Program Files\Common Files
%CommonProgramFiles(x86)% C:\Program Files (x86)\Common Files
%CommonProgramW6432% C:\Program Files\Common Files
%COMPUTERNAME% The computer name of the current local system.
%COMSPEC% C:\Windows\System32\cmd.exe
%DATE% (command prompt only) Current date in format determined by Date command
%DriverData% C:\Windows\System32\Drivers\DriverData
%ERRORLEVEL% (command prompt only) Number defining exit status of previous command or program
%HOMEDRIVE% C:
%HOMEPATH% \Users(user-name)
%LOCALAPPDATA% C:\Users(user-name)\AppData\Local
%LOGONSERVER% \MicrosoftAccount
%NUMBER_OF_PROCESSORS% 8
%OneDrive% Current OneDrive folder location
%OS% Windows_NT
%PATH% C:\WINDOWS, C:\WINDOWS\system32, C:\WINDOWS\System32\Wbem, C:\WINDOWS\System32\WindowsPowerShell\v1.0
%PATHEXT% COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
%PROCESSOR_ARCHITECTURE% AMD64
%PROCESSOR_IDENTIFIER% Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
%PROCESSOR_LEVEL% 6
%PROCESSOR_REVISION% 3c03
%ProgramData% C:\ProgramData
%ProgramFiles% C:\Program Files
%ProgramFiles(x86)% C:\Program Files (x86)
%ProgramW6432% C:\Program Files
%PROMPT% (command prompt only) Code for current command prompt format. Code is usually $P$G
%PSModulePath% C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
%PUBLIC% C:\Users\Public
%RANDOM% (command prompt only) To get random number between 0 and 32767
%SessionName% When logging on directly to machine, returns "Console".




When client connects via terminal server session, is combination of


connection name, followed by pound symbol {#} and session number.
%SystemDrive% C:
%SystemRoot% C:\Windows
%TEMP% C:\Users(user-name)\AppData\Local\Temp
%TIME% (command prompt only) Current time in format determined by Time command
%TMP% C:\Users(user-name)\AppData\Local\Temp
%USERDOMAIN% The network domain name associated with the current user.
%USERDOMAIN_ROAMINGPROFILE% The network domain name associated with the current roaming profile.
%USERNAME% (user-name)
%USERPROFILE% C:\Users(user-name)
%WINDIR% C:\Windows

Get the temp folder when using code: Environ("TEMP") (or Environ("TMP") - which should be the same)

Getting the user's profile under C: drive Environ("USERPROFILE")

Get the appdata/roaming folder Environ("APPDATA")

Environ("SystemRoot") - the C:\Windows folder where Environ("windir")

Environ("HOMEDRIVE") - the C: drive

The following is from https://ss64.com/nt/shell.html

Shell: folder shortcut Description
shell:AppUpdatesFolder Display installed Windows Updates
shell:Administrative Tools Open the user‘s Start Menu\Administrative Tools folder (if any)
shell:Common Administrative Tools Open All Users Start Menu\Administrative Tools folder
shell:Common AppData Open the Public Application Data folder
shell:AppData Open the user‘s Application Data folder
shell:Local AppData Open the user‘s Application Data folder
shell:appsFolder Apps folder
shell:Cache Open the Temporary Internet Files folder
shell:SystemCertificates Open the user‘s certificates folder
shell:CSCFolder Open the Client Side Cache Offline Files folder, if supported
shell:CD Burning Open the folder where files are stored before being burned to disc
shell:Contacts Open the user‘s Windows Contacts folder
shell:Cookies Open the Internet Explorer Cookies folder
shell:CredentialManager Open the user‘s Credentials folder
shell:ConnectionsFolder Open the list of Network Connections
shell:ControlPanelFolder Display the Control Panel
shell:Cryptokeys Open the user‘s encryption keys folder
shell:Desktop Open the user‘s desktop folder
shell:Common Desktop Open the Public Desktop
shell:DpAPIKeys Opens the user‘s AppData\Roaming\Microsoft\Protect folder
shell:Common Documents Open the Public Documents folder
shell:Downloads Open the user‘s downloads folder
shell:CommonDownloads Open the Public Downloads folder
shell:Favorites Open the Internet Explorer Favorites folder
shell:Fonts Open the Fonts folder
shell:Gadgets Open the user folder of downloaded Sidebar Gadgets
shell:Default Gadgets Open the default Sidebar Gadgets folder
shell:Games Open the Games folder
shell:GameTasks Open the user‘s Game Explorer folder
shell:History Open the user‘s History folder
shell:HomeGroupFolder Open the HomeGroup folder
shell:HomeGroupCurrentUserFolder Open the HomeGroup folder for the currently logged-on user (if any)
shell:InternetFolder Launches Internet Explorer Applets and applications
shell:ImplicitAppShortcuts Open the hidden ImplicitAppShortcuts folder
shell:Libraries Open the Libraries folder
shell:DocumentsLibrary Open the Documents library
shell:PublicLibraries Display public libraries, if any
shell:MusicLibrary Display your Music library
shell:CommonMusic Open the Public Music folder
shell:My Music Open the user‘s Music folder
shell:SampleMusic Open the Sample Music folder
shell:PhotoAlbums Open the user‘s Pictures\Slide Shows folder (if present)
Shell:AccountPictures Account Pictures
shell:PicturesLibrary Display your Pictures library
shell:CommonPictures Open the Public Pictures folder
shell:SamplePictures Open the Sample Pictures folder
shell:Original Images Open the Windows Photo Gallery Original Images folder, if installed
shell:VideosLibrary Display your Videos library
shell:Links Open the user‘s Links folder
shell:MyComputerFolder Open the Computer folder
shell:NetHood Open the user‘s Network Places folder
shell:NetworkPlacesFolder Open the Network Places folder
shell:OEM Links Display links provided by your PC manufacturer (if any)
shell:Personal Open the user‘s Documents folder
shell:PrintHood Open the user‘s printer shortcuts folder
shell:Profile Open the user‘s profile folder
shell:User Pinned Access shortcuts pinned to the Start menu or Taskbar
shell:Playlists Open the user‘s \Music\Playlists folder
shell:UserProfiles Open the folder holding all user profiles
shell:PrintersFolder Open the Printers folder
shell:Programs Open the user‘s Start Menu Programs folder
shell:Common Programs Open the Public Start Menu Programs folder
shell:AddNewProgramsFolder Open the Control Panel "Install a program from the network" applet
shell:ChangeRemoveProgramsFolder Open the Control Panel "Uninstall or change a program" applet
shell:ProgramFiles Open the Program Files folder
shell:ProgramFilesCommon Open the Program Files\Common Files folder
shell:ProgramFilesX86 "Display 32-bit programs stored on 64-bit Windows,
or the \Program Files folder on 32-bit Windows"
shell:ProgramFilesCommonX86 "Open the Common Files for 32-bit programs stored on 64-bit Windows,
Or the Program Files\Common Files folder on 32-bit Windows"
shell:PublicGameTasks Open the Public Game Explorer folder
shell:Public Open the Users\Public folder (Shared files)
shell:Quick Launch Open the Quick Launch folder (disabled by default)
shell:Recent Open the user‘s Recent Documents folder
shell:RecycleBinFolder Open the Recycle Bin
shell:ResourceDir Open the Windows Resources folder (themes are stored here)
shell:Ringtones Display the user's Ringtones folder
shell:CommonRingtones Open the Public ringtones folder.
shell:SavedGames Open the Saved Games folder
shell:Searches Open the saved searches folder
shell:SearchHomeFolder Open the Windows Search tool
shell:SendTo Open the user‘s Send To folder
shell:Start Menu Open the user‘s Start Menu folder
shell:Common Start Menu Open the Public Start Menu folder
shell:Startup Open the user‘s Startup folder
shell:Common Startup Open the Public Startup folder
shell:SyncCenterFolder Display Sync Centre
shell:ConflictFolder Display Sync Centre Conflicts
shell:SyncResultsFolder Display Sync Centre Results
shell:SyncSetupFolder Open the Sync Centre Setup options
shell:System Open the Windows System folder
shell:Systemx86 "Open the Windows System folder for 32-bit files on 64-bit Windows,
Or \Windows\System32 on 32-bit Windows"
shell:Templates Open the user‘s Templates folder
shell:Common Templates Open the Public Templates folder
shell:Roaming Tiles Display further user tiles
shell:UserTiles Display your user tiles (the images you can use for your account)
shell:PublicUserTiles Open the Public user tiles folder
shell:My Video Open the user‘s Videos folder
shell:CommonVideo Open the Public Video folder
shell:SampleVideos Open the Sample Videos folder
shell:Windows Open the Windows installation folder (usually \Windows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment