Windows Explorer - shell stuff
Environment Variables
http://en.wikipedia.org/wiki/Environment_variable
| Variable | Windows XP | Windows Vista/7 |
|---|---|---|
| %ALLUSERSPROFILE% and %PROGRAMDATA% | C:\Documents and Settings\All Users | C:\ProgramData |
| %APPDATA% | C:\Documents and Settings\{username}\Application Data | C:\Users\{username}\AppData\Roaming |
| %COMPUTERNAME% | {computername} | {computername} |
| %COMMONPROGRAMFILES% | C:\Program Files\Common Files | C:\Program Files\Common Files |
| %COMMONPROGRAMFILES(x86)% | C:\Program Files (x86)\Common Files | C:\Program Files (x86)\Common Files |
| %COMSPEC% | C:\Windows\System32\cmd.exe | C:\Windows\System32\cmd.exe |
| %HOMEDRIVE% | C: | C: |
| %HOMEPATH% | \Documents and Settings\{username} | \Users\{username} |
| %LOCALAPPDATA% | C:\Users\{username}\AppData\Local | |
| %LOGONSERVER% | \\{domain_logon_server} | \\{domain_logon_server} |
| %PATH% | C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;{plus program paths} | C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;{plus program paths} |
| %PATHEXT% | .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.WSF;.WSH | .com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh;.msc |
| %PROGRAMFILES% | %SystemDrive%\Program Files | %SystemDrive%\Program Files |
| %PROGRAMFILES(X86)% | %SystemDrive%\Program Files (x86) (only in 64-bit version) | %SystemDrive%\Program Files (x86) (only in 64-bit version) |
| %PROMPT% | Code for current command prompt format. Code is usually $P$G | Code for current command prompt format. Code is usually $P$G |
| {Drive}:\$Recycle.Bin | C:\Recycle.Bin | C:\$Recycle.Bin |
| %SystemDrive% | C: | C: |
| %SystemRoot% | The Windows directory, usually C:\Windows, formerly C:\WINNT | %SystemDrive%\Windows |
| %TEMP% and %TMP% | %SystemDrive%\Documents and Settings\{username}\Local Settings\Temp | %SystemDrive%\Users\{username}\AppData\Local\Temp |
| %USERDOMAIN% | {userdomain} | {userdomain} |
| %USERDATA% | %SystemDrive%\Documents and Settings\{username} | %SystemDrive%\Users\{username} |
| %USERNAME% | {username} | {username} |
| %USERPROFILE% | %SystemDrive%\Documents and Settings\{username} | %SystemDrive%\Users\{username} |
| %WINDIR% | C:\Windows | C:\Windows |
| %PUBLIC% | %SystemDrive%\Users\Public | |
| %PROGRAMDATA% | %SystemDrive%\ProgramData | |
| %PSModulePath% | %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\ |
Execute from commandline command - set
ALLUSERSPROFILE=C:\ProgramData ANDROID_HOME=C:\Program Files\Android\android-sdk-windows ANDROID_NDK_ROOT=c:\bin\android\android-ndk-r7\ ANDROID_SDK=C:\Program Files\Android\android-sdk-windows ANT_HOME=c:\bin\apache\Ant\ APPDATA=C:\Users\%username%\AppData\Roaming asl.log=Destination=file CLASSPATH=.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip CommonProgramFiles=C:\Program Files\Common Files COMPUTERNAME=%username%-PC ComSpec=C:\Windows\system32\cmd.exe CONNECTION_NAME=Wireless Network Connection Cor_Enable_Profiling=0 DNS1=10.1.0.11 DNS2=10.0.1.1 DXSDK_DIR=C:\Program Files\Microsoft DirectX SDK (March 2009)\ EAZFUSCATOR_NET_HOME=C:\Program Files\Eazfuscator.NET FP_NO_HOST_CHECK=NO GATEWAY_ROUTER=10.66.66.193 GTK_BASEPATH=C:\Program Files\GtkSharp\2.12\ HOMEDRIVE=C: HOMEPATH=\Users\%username% IP=10.11.11.11 IP_PERSONAL=192.168.1.193 IP_TARGET=192.168.11.251 LOCALAPPDATA=C:\Users\%username%\AppData\Local LOGONSERVER=\\%username%-PC MOZ_PLUGIN_PATH=C:\Program Files\Foxit Software\Foxit Reader\plugins\ NETWORK=10.0.0.0/8 NETWORK_MASK=255.0.0.0 NUMBER_OF_PROCESSORS=2 OS=Windows_NT Path= PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC PROCESSOR_ARCHITECTURE=x86 PROCESSOR_IDENTIFIER=x86 Family 6 Model 23 Stepping 6, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=1706 ProgramData=C:\ProgramData ProgramFiles=C:\Program Files PROMPT=$P$G PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ PUBLIC=C:\Users\Public QTJAVA=C:\Program Files\Java\jre6\lib\ext\QTJava.zip SESSIONNAME=Console SystemDrive=C: SystemRoot=C:\Windows TEMP=C:\Users\username\AppData\Local\Temp TMP=C:\Users\username\AppData\Local\Temp USERDOMAIN=username-PC USERNAME=username USERPROFILE=C:\Users\%username% VBOX_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\ VS100COMNTOOLS=c:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\ VSSDK100Install=C:\Program Files\Microsoft Visual Studio 2010 SDK\ windir=C:\Windows WIX=C:\Program Files\Windows Installer XML v3.5\ XNAGSShared=C:\Program Files\Common Files\Microsoft Shared\XNA\ XNAGSv4=C:\Program Files\Microsoft XNA\XNA Game Studio\v4.0\
Startup (automatically start applications after login/logon
In Vista
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Context menus (right click) in Windows Explorer
SendTo
SendTo (command and context menu). Command opens folder where target shortcuts or apps for sendto are located.
Folders (for some folder elevated rights might be necessary):
- %APPDATA%\Microsoft\Windows\SendTo
- %USERPROFILE%\SendTo
(C:\Users\username\SendTo) - %ALLUSERPROFILE%\SendTo
c:\Users\AllUsers\SendTo - "%SYSTEMDRIVE%\Users\DefaultUser\SendTo"
Sample:
Visual Studio solution file sample
Command New
To add custom items to Explorer New command (right click +/ New)
Steps:
- Run (Start +/ Run) +/ regedit
- navigate to: HKEY_CLASSES_ROOT\.extension
- Create a new key named ShellNew
- In the right-pane, create a REG_SZ (String Value) named NullFile or Data or FileName or Command
To add some file located in default folders (read comments) to Context Menu's New command merge following reg file (the empty solution file is in %SYSTEMROOT%\ShellNew, c:\windows\shellnew).
File is commented for better understanding.
Windows Registry Editor Version 5.00 ; ShellNew add custom to Explorer +/ new command ; ; Order or execution / Priority is as follows (shown by tests): ; ; FileName ; Creates a file that is a copy of a specified file. FileName is a REG_SZ value, set to the ; fully qualified path of the file to be copied. ; folders search order: ; 1. %Userprofile%\Templates ; 2. %Allusersprofile%\Templates ; 3. %Systemroot%\ShellNew ; ; Command ; Executes an application. This is a REG_SZ value specifying the path of the ; application to be executed. For example, you could set it to launch a wizard. ; ; Data ; Creates a file containing specified data. Data is a REG_BINARY value with the file's data. ; Data is ignored if either NullFile or FileName is specified. ; ; NullFile ; Creates an empty file. NullFile is not assigned a value. ; "NullFile"="" ; [HKEY_CLASSES_ROOT\.ext\ShellNew] "FileName"="filename.ext" ; "NullFile"=""
Sample:
Visual Studio solution file sample
New +/ Shortcut
"New Shortcut" is an example where the first method is used (Command). Selecting the File New > Shortcut, actually runs this command:
rundll32.exe appwiz.cpl,NewLinkHere %1
Defined in this key:
HKEY_CLASSES_ROOT\.lnk\ShellNew Command = rundll32.exe appwiz.cpl,NewLinkHere %1
Command Prompt here
Command Prompt here
REGEDIT4 [HKEY_CLASSES_ROOT\Directory\shell\DosHere] @="Command &Prompt:" [HKEY_CLASSES_ROOT\Directory\shell\DosHere\command] @="C:\\windows\\SYSTEM32\\cmd.exe /k cd \"%1\"" [HKEY_CLASSES_ROOT\Drive\shell\DosHere] @="DOS &Prompt Here" [HKEY_CLASSES_ROOT\Drive\shell\DosHere\command] @="C:\\windows\\SYSTEM32\\cmd.exe /k cd \"%1\""
Command Prompt here as Administrator
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\runas] @="Open Command Window Here (Administrator)" [HKEY_CLASSES_ROOT\Directory\shell\runas\command] @="cmd.exe /s /k pushd \"%V\""
Cygwin bash shell here
REGEDIT4 [HKEY_CLASSES_ROOT\Directory\shell\CygwinHere] @="Cygwin &Prompt:" "EditFlags"=hex:01,00,00,00 [HKEY_CLASSES_ROOT\Directory\shell\CygwinHere\command] ;@="C:\\cygwin\\bin\\rxvt.exe -bg white -fg black -sr -sl 1000 -fn \"Fixedsys\" -ls -e /usr/bin/bash --login -c \"cd \\\"`cygpath -u '%1'`\\\"; exec bash\"" @="c:\\cygwin\\bin\\bash.exe --login -c \"cd '%1' ; exec /bin/bash -rcfile ~/.bashrc\"" ;@="c:\\cygwin\cygwin.bat" [HKEY_CLASSES_ROOT\Drive\shell\CygwinHere] @="Cygwin &Prompt Here" [HKEY_CLASSES_ROOT\Drive\shell\CygwinHere\command] ;@="C:\\cygwin\\bin\\rxvt.exe -bg white -fg black -sr -sl 1000 -fn \"Fixedsys\" -ls -e /usr/bin/bash --login -c \"cd \\\"`cygpath -u '%1'`\\\"; exec bash\"" @="c:\\cygwin\\bin\\bash.exe --login -c \"cd '%1' ; exec /bin/bash -rcfile ~/.bashrc\"" ;@="c:\\cygwin\cygwin.bat"
Windows Explorer here - Explore
Windows Registry Editor Version 5.00 [HKEY_USERS\.DEFAULT\Control Panel\Accessibility] [HKEY_USERS\.DEFAULT\Control Panel\Accessibility\Blind Access] "On"="0" HKEY_CLASSES_ROOT\Directory\shell\Explore] Value Name: (Default) Data Type: REG_SZ (String Value) Value Data: explorer.exe /e,/root,"%1" Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell] @="explorer.exe /e,/root,\"%1\"" [HKEY_CLASSES_ROOT\Directory\shell\cmd] @="@shell32.dll,-8506" "Extended"="" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\Directory\shell\cmd\command] @="cmd.exe /s /k pushd \"%V\"" [HKEY_CLASSES_ROOT\Directory\shell\CygwinHere] @="Cygwin &Prompt:" "EditFlags"=hex:01,00,00,00 [HKEY_CLASSES_ROOT\Directory\shell\CygwinHere\command] @="c:\\cygwin\\bin\\bash.exe --login -c \"cd '%1' ; exec /bin/bash -rcfile ~/.bashrc\"" [HKEY_CLASSES_ROOT\Directory\shell\DosHere] @="Command &Prompt:" [HKEY_CLASSES_ROOT\Directory\shell\DosHere\command] @="C:\\windows\\SYSTEM32\\cmd.exe /k cd \"%1\"" [HKEY_CLASSES_ROOT\Directory\shell\find] "SuppressionPolicy"=dword:00000080 "LegacyDisable"="" [HKEY_CLASSES_ROOT\Directory\shell\find\command] @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\ 00,5c,00,45,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,00,2e,00,65,00,78,00,\ 65,00,00,00 [HKEY_CLASSES_ROOT\Directory\shell\find\ddeexec] @="[FindFolder(\"%l\", %I)]" "NoActivateHandler"="" [HKEY_CLASSES_ROOT\Directory\shell\find\ddeexec\application] @="Folders" [HKEY_CLASSES_ROOT\Directory\shell\find\ddeexec\topic] @="AppProperties" [HKEY_CLASSES_ROOT\Directory\shell\runas] @="Open Command Window Here (Administrator)" [HKEY_CLASSES_ROOT\Directory\shell\runas\command] @="cmd.exe /s /k pushd \"%V\""
Command prompt here
REGEDIT4 [HKEY_CLASSES_ROOT\Directory\shell\cmd] @="Open Command Window Here" [HKEY_CLASSES_ROOT\Directory\shell\cmd\command] @="cmd.exe /k \"cd %L\"" [HKEY_CLASSES_ROOT\Drive\shell\cmd] @="Open Command Window Here" [HKEY_CLASSES_ROOT\Drive\shell\cmd\command] @="cmd.exe /k \"cd %L\""
Visual Studio command prompt here
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\Visual Studio .NET 2010 Command Prompt] [HKEY_CLASSES_ROOT\Directory\shell\Visual Studio .NET 2010 Command Prompt\command] @="cmd.exe %1 /K \"C:\\Program Files\\Microsoft Visual Studio 10.0\\Common7\\Tools\\vsvars32.bat\""
Open with...
Open with Notepad
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\Open with Notepad] [HKEY_CLASSES_ROOT\*\shell\Open with Notepad\command] @="notepad.exe %1"
Open with Notepad - remove
Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\*\shell\Open with Notepad]
Open unknown files with Notepad
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Unknown\shell] @="notepad" [HKEY_CLASSES_ROOT\Unknown\shell\notepad] @="Open with Notepad" [HKEY_CLASSES_ROOT\Unknown\shell\notepad\command] @="C:\\WINDOWS\\NOTEPAD.EXE %1" [HKEY_CLASSES_ROOT\Unknown\shell\Open\Command] @="notepad.exe %1"
Take ownership
Install
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\runas] @="Take Ownership" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\*\shell\runas\command] @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F" "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F" [HKEY_CLASSES_ROOT\Directory\shell\runas] @="Take Ownership" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\Directory\shell\runas\command] @="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t" "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
Uninstall
Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\*\shell\runas] [-HKEY_CLASSES_ROOT\Directory\shell\runas]
Tortoise
Disable
Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\Folder\ShellEx\ContextMenuHandlers\TortoiseSVN] [-HKEY_CLASSES_ROOT\Folder\ShellEx\DragDropHandlers\TortoiseSVN] [-HKEY_CLASSES_ROOT\Drive\shellex\ContextMenuHandlers\TortoiseSVN] [-HKEY_CLASSES_ROOT\Drive\shellex\PropertySheetHandlers\TortoiseSVN] [-HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\TortoiseSVN] [-HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\TortoiseSVN] [-HKEY_CLASSES_ROOT\Directory\shellex\CopyHookHandlers\TortoiseSVN] [-HKEY_CLASSES_ROOT\Directory\shellex\DragDropHandlers\TortoiseSVN] [-HKEY_CLASSES_ROOT\Directory\shellex\PropertySheetHandlers\TortoiseSVN] [-HKEY_CLASSES_ROOT\*\shellex\PropertySheetHandlers\TortoiseSVN] [-HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\TortoiseSVN] [-HKEY_CLASSES_ROOT\lnkfile\shellex\ContextMenuHandlers\TortoiseSVN] [-HKEY_CLASSES_ROOT\LibraryLocation\ShellEx\ContextMenuHandlers\TortoiseSVN] [-HKEY_CLASSES_ROOT\LibraryFolder\background\shellex\ContextMenuHandlers\TortoiseSVN]
Enable
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\ShellEx\ContextMenuHandlers\TortoiseSVN]
@="{30351349-7B7D-4FCC-81B4-1E394CA267EB}"
[HKEY_CLASSES_ROOT\Folder\ShellEx\DragDropHandlers\TortoiseSVN]
@="{3035134A-7B7D-4FCC-81B4-1E394CA267EB}"
[HKEY_CLASSES_ROOT\Drive\shellex\ContextMenuHandlers\TortoiseSVN]
@="{30351349-7B7D-4FCC-81B4-1E394CA267EB}"
[HKEY_CLASSES_ROOT\Drive\shellex\PropertySheetHandlers\TortoiseSVN]
@="{30351349-7B7D-4FCC-81B4-1E394CA267EB}"
[HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\TortoiseSVN]
@="{30351349-7B7D-4FCC-81B4-1E394CA267EB}"
[HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\TortoiseSVN]
@="{30351349-7B7D-4FCC-81B4-1E394CA267EB}"
[HKEY_CLASSES_ROOT\Directory\shellex\CopyHookHandlers\TortoiseSVN]
@="{30351349-7B7D-4FCC-81B4-1E394CA267EB}"
[HKEY_CLASSES_ROOT\Directory\shellex\DragDropHandlers\TortoiseSVN]
@="{3035134A-7B7D-4FCC-81B4-1E394CA267EB}"
[HKEY_CLASSES_ROOT\Directory\shellex\PropertySheetHandlers\TortoiseSVN]
@="{30351349-7B7D-4FCC-81B4-1E394CA267EB}"
[HKEY_CLASSES_ROOT\*\shellex\PropertySheetHandlers\TortoiseSVN]
@="{30351349-7B7D-4FCC-81B4-1E394CA267EB}"
[HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\TortoiseSVN]
@="{30351349-7B7D-4FCC-81B4-1E394CA267EB}"
[HKEY_CLASSES_ROOT\lnkfile\shellex\ContextMenuHandlers\TortoiseSVN]
@="{30351349-7B7D-4FCC-81B4-1E394CA267EB}"
[HKEY_CLASSES_ROOT\LibraryLocation\ShellEx\ContextMenuHandlers\TortoiseSVN]
@="{30351349-7B7D-4FCC-81B4-1E394CA267EB}"
[HKEY_CLASSES_ROOT\LibraryFolder\background\shellex\ContextMenuHandlers\TortoiseSVN]
@="{30351349-7B7D-4FCC-81B4-1E394CA267EB}"