This is a repository for some of my Windows customization tips and tricks.

apps

win10

UAC

Control Panel: Change User Account Settings (aka: search Start Menu for UAC) * Never = what I have at work: it doesn't even bother asking for UAC * Don't Dim = it will ask * Default = it will dim the screen, then ask (the dim can be very slow)

Misc

Open Explorer in PC not QuickAccess: Explorer | File | Options > General: Open File Explorer to: This PC Turn off login/lock screen image Disable Fast User Switch: HKLM\SOFTWARE\Policies\Microsoft\Windows\Personalization: NoLockScreen[DWORD]=1 this one removes the Sea Cave image when selecting which user Settings | Personalization | Lock Screen | Show...picture...sign-in...screen (off) this one removes the image after the Sea Cave, while you're actually typing password / clicking logon Turn off Fast User Switch (which messes up KeePass) HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System: HideFastUserSwitching[REG_DWORD]=1 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\UserSwitch: Enabled=1 This second one is described as possibly turning off the auto-login after reboot, but I haven't proven it yet

Corrupted User

Manifests as the START menu search not working, and/or the START menu not even popping up Search from START doesn't work (type in the START menu and have it find applications) Some claim you just have to re-start search processes, but those never worked for me Some claim you have to create a new user, and move all your files to the new user This compromise works for me (2-3 times when home accounts have corrupted): 1. Create NewUser account; maybe need to reboot after 2. Log in as NewUser; verify Cortana works; logout 3. Log in as me; verify search works (it has in the 3-4 times I've had to do this at home) 4. Delete NewUser START doesn't pop out Right-Click on START still usually works, so you can log out / reboot from there, if necessary The NewUser procedure may or may not affect this issue Option 1: Admin Powershell - sfc 1. Run Powershell * Launch Task Manager: Ctrl-Shift-Escape * File | Run New Task * Check the (_) Administrative Privileges; run powershell 2. sfc /scannow * if 'found corrupt, unable to fix' then run * DISM /Online /Cleanup-Image /RestoreHealth Option 2: Admin Powershell - Get-AppXPackage 1. Run Powershell (per above) 2. Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

Remote Desktop

To Remote Desktop into Win10 from an older linux, need at least rdesktop 1.5.0 Win10 side: As of 2018-Apr-12, they removed us from Local Administrator. Aside from the settings that I originally had, IT said to ADD MAXIM-IC\Peter.Jones, and checked Allow Remote Assistance. IT temporarily said to disable Windows Firewall, but quickly backtracked, saying it wasn't necessary, and that Firewall will be re-enabled by group policy, anyway. It seems to work without Firewall disabled... Control Panel > (All) > System > Advanced System Settings, REMOTE tab Remote Desktop section check ☑ Allow remote connections to this computer, uncheck ☐ Allow connections only from... Select Users... > ADD > MAXIM-IC\Peter.Jones = even though it says "MAXIM-IC\Peter.Jones already has access", still needed to add Remote Assistance: check ☑ Allow Remote Assistance connections to this computer For Win10: regedit HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp, set SecurityLayer DWORD to 1 (which uses backward-compatible rdesktop protocol) It must be 1. If it's 2, it will not work. (2 is the modern protocol, 1 is the backward-compatible protocol) Linux side: ~/bin/rdesktop -u peter.jones -d MAXIM-IC -p - -g 1670x1024-9+0 -a 16 -r clipboard:PRIMARYCLIPBOARD $MY_IP_ADDRESS Because of the -p -, it will prompt you for your password (at some point a couple years ago, Windows did an update which made it stop working to type your password into the GUI window) Because of the password input, the terminal window where you typed this must remain open, with the rdesktop command in the foreground. I usually spawn a new terminal window, then minimize it (or move it to one of the other linux "destops") As of Jul 27, 2018 (with Windows 10 version1709, 10.0.16299.547), I was able to go back to not using the -p - , and the GUI password prompt worked again: ~/bin/rdesktop -u peter.jones -d MAXIM-IC -g 1670x1024-9+0 -a 16 -r clipboard:PRIMARYCLIPBOARD $MY_IP_ADDRESS I have a wrapper script around that (~/bin/rlaptop) which automates some of that, and I have a script running on Windows Task Scheduler that copies the IP address from my laptop into linux, for the wrapper to use for $MY_IP_ADDRESS You can grab the perl script from my svn sandbox You can also grab the Windows Task Scheduler XML file (which you can import in order to schedule that task) Alternately, you should be able to use your laptop's FQDN, like MFN-LT-200651.maxim-ic.internal , but that didn't always seem to update to my laptop's IP (especially if I had recently switched from WiFi to ethernet-cable or vice versa)

Storage

Autorun

In the old DOS days, autoexec.bat was used to set variables and do other configs

The equivalent of that in modern era (Win7, Win10, Win11) is to use the AUTORUN setting

https://superuser.com/questions/144347/is-there-windows-equivalent-to-the-bashrc-file-in-linux https://superuser.com/questions/269818/change-default-code-page-of-windows-console-to-utf-8 HKLM\Software\Microsoft\Command Processor\\Autorun : all users HKCU\Software\Microsoft\Command Processor\\Autorun Example values: @chcp 65001>nul Changes codepage to UTF8 (SU#269818) %HOMEPATH%\bashrc.bat Runs bashrc.bat from c:\users\username or equivalent %USERPROFILE%\bashrc.bat The same, but includes the drive https://ss64.com/nt/cmd.html - has mention of AUTORUN as well

Start Menu

Aside from AUTORUN, the apps that are run at startup are found in:

Confirmed that Task Manager and Windows Settings use the same list, which is the combo of the two Startup folders plus the two registry keys (plus Cortana, and maybe one other that I haven't located yet)

win11

Changes RightClick verbs/context menu:
Windows Blog "Extending the Context Menu and Share Dialog in Windows 11 ||
always show full context menu = maybe caused START menu to stop working right

registry

Shortcuts * HKCU = HKEY_CURRENT_USER: this user's infor * HKLM = HKEY_LOCAL_MACHINE: computer-wide settings * HKCR = HKEY_CLASSES_ROOT: apparently obsoleted long ago, but still works * If you have just one of the other two defined for a given key, it will replicate here * If you have both of the other two defined for a given key, I don't know which takes precedence * If you add a key here, it usually seems to replicate it in HKLM * Try to wean myself off of this location Using the nircmd trick above, can copy locations from this document, and open RegEdit directly to that Key or Value; shortcuts work Environment variables * System: HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\ * User: HKCU\Environment\ To make sure TEMP and TMP are REG_EXPAND_SZ (so they will honor %variables%) REG QUERY HKCU\Environment REG ADD HKCU\Environment /v TEMP /t REG_EXPAND_SZ /d ^%USERPROFILE^%\AppData\Local\Temp /f REG ADD HKCU\Environment /v TMP /t REG_EXPAND_SZ /d ^%USERPROFILE^%\AppData\Local\Temp /f REG QUERY HKCU\Environment

file associations

* RClick > "Open With" * File Extension to Application mapping: * Registry Key = HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\ * reference: https://stackoverflow.com/a/3924822/5508606 * ...\FileExts\.ext\OpenWithList\ vs ...\FileExts\.ext\OpenWithProgids\ * reference: https://docs.microsoft.com/en-us/visualstudio/extensibility/specifying-file-handlers-for-file-name-extensions?view=vs-2022 * OpenWithList\ shows the Applications\ name for any that show up in the "Open With" menu - VALUE: if the value is "blah.exe", then it will look in "Applications\blah.exe", described below EXAMPLE: FileExts\.pl\ OpenWithList\ a [REG_SZ] = {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\OpenWith.exe b [REG_SZ] = perl.exe ⇒ this will have perl.exe and OpenWith as the "Open With" options * OpenWithProgids\ is similar, but it uses the "progid" * VALUE's NAME: the name of the HKCR\xxxx association-name EXAMPLE: FileExts\.pl\ OpenWithProgids\ pl_auto_file [REG_NONE] = zero-length binary value * CAVEATS: * the note shows it is XP-only... and given it's for the VS2022 documentation, it's not an outdated document which doesn't know about modern Windows versions * despite the XP-only note, my experiments show that it shows up in the "second" level of "Open With" (the first level being the main list, the second being the "choose another app" option, and the third level being browsing for the executable) * https://docs.microsoft.com/en-us/windows/win32/shell/fa-file-types gives the opposite advice, saying ProgIds is preferred * UserChoice\ * If you want to go back to the system default, delete the whole ...\FileExts\.ext\UserChoice key, and possibly the Application Toast (below) * Note that it creates a hash, so you cannot change the user's choice for them ;-) * Application Details * HKEY_CURRENT_USER\Software\Classes\Applications\ * HKEY_LOCAL_MACHINE\Software\Classes\Applications\ * HKEY_CLASSES_ROOT\Applications\ = the first two are auto-replicated into the third; these entries map application names (like notepad++.exe) to the actual command path that implements them * KEY: ...\Applications\appname.exe\ - basically equivalent to the "Association Details" entry in the old style (below) * VALUE (Default): The string that will show up as the name of the file type in Explorer * VALUE FriendlyAppName: The string that will show up in the "Open With" menu. If missing, it will get it from elsewhere. * KEY DefaultIcon\ * VALUE (Default) [REG_SZ] = (optional) The default icon for all file types that are set to OpenWith this Application * KEY Shell\ = (optional) works just like the "NameOfAssociation\Shell" key above * VALUE (Default): default (double-click) verb * KEY _verb_\: there can be more than one _verb_, just like in "Association Details" * VALUE (Default) [REG_SZ] = human readable version of Verb name; if missing, it will use the name of the _verb_ KEY * VALUE Icon [REG_SZ] = (optional) path to icon that will show up in the RightClick menu for this verb * KEY command\ * VALUE (Default) [REG_SZ] = c:\path\to\executable "%1" %* * KEY SupportedTypes\ = (optional): a list of extensions that this application supports (which may help with the OpenWith) * VALUE .ext [REG_SZ] = empty string. The name of the value should be dot-extension; have one VALUE for each extension that the app wants to claim * Application Toasts * HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts = have value names like Applications\some.exe_.ext, where Applications\some.exe is found in one of the ...\Applications\ keys above, and .ext is the extension being associated with the application * You may need to remove the Toasts as well as the UserChoice when trying to undo an unwanted OpenWith that doesn't seem to go away * Other references: - https://stackoverflow.com/a/41743662 : Classes\MyApp vs Classes\Applications\MyApp.exe * Old Windows File Extensions * User: HKCU\Software\Classes * System: HKLM\Software\Classes * Old Way: HKCR\ * I recently learned this had actually been obsoleted a decade ago (I forget if it was Win95 or WinXP) * Anyplace in this document where I mention an HKCR version, could also use the User or System below * https://social.msdn.microsoft.com/Forums/vstudio/en-US/630ed1d9-73f1-4cc0-bc84-04f29cffc13b/what-registry-keys-are-responsible-for-file-extension-association?forum=netfxbcl * File Extension: HKCU\Software\Classes\.ext\ (Default) = NameOfAssociation (ie, PerlScript or txtfile, etc) PerceivedType = text (or similar) ShellNew\ see Customized Context Menu, below * Association Details: HKCU\Software\Classes\NameOfAssociation (Default) = Text Version of Name of Association (shown in Explorer) DefaultIcon\(DEFAULT) = PathToIcon Shell\ (Default) = nameOfVerb (sets the default verb to run for double-click) Icon = optional path to icon for this verb's entry in the menu nameOfVerb\ (Default) = Human Readable Verb command\(Default) = path\to\exe "%1" %* make it REG_EXPAND_SZ if you want path to include %EnvironmentVariables% there can be multiple verbs

protocol associations

It's also possible to add custom protocols (alongside https://, file://, and the like). This MSDN/MSLearn guide shows HKCR\ or HKCU\Software\Classes\ or HKLM\Software\Classes\ alert\ (Default) = "URL:Alert Protocol" URL Protocol = "" DefaultIcon\ (Default) = "alert.exe,1" shell\ open\ command\ (Default) = "C:\Program Files\Alert\alert.exe" "%1" ... which I used in N++ Community Forum to give an example of a custom protocol to test protocol 260-char limit

ssh://

The following example will set up the ssh:// protocol to run with putty.exe. However, protocol handlers send the entire string (see this SU question), so you need a wrapper (see this article) which will remove the ssh:// prefix and / suffix that the protocol handler includes, and will also convert %XX URL-encoded characters to their actual character. (This Cisco tutorial includes a more detailed batch file than the article I linked earlier.)

You cannot directly call a ssh://username@hostname URL from the cmd.exe CLI; however, START "" "ssh://username@hostname" will work. (/B sometimes works, but depending on the handler app, may actually require you to hit ENTER before it launches... I don't know why)

With the ssh:// protocol defined, then ssh://username@hostname URLs in Notepad++ will properly launch putty with the active user and site.

registry:

HKCU\Software\Classes\ ssh\ (Default) = "URL:ssh Protocol" URL Protocol = "" DefaultIcon\ (Default) = "c:\path\to\putty.exe",1 shell\ open\ command\ (Default) = "C:\path\to\perl.exe" "c:\path\to\ssh_protocol.pl" %1

c:\path\to\ssh_protocol.pl

#!perl use 5.014; # strict, //, s//r use warnings; close STDIN; close STDOUT; close STDERR; for( join ' ', @ARGV) { s{^ssh://}{}; s{/$}{}; s{%([0-9A-Z]{2})}{chr hex $1}gie; exec "putty $_"; }

Aside: KeePass can define pseudo-protocols for internal use: Tools > Options > Integration >URL Overrides has a list of predefined ones that you can define, or you can set up your own. But enabling the ssh:// there will allow the URL field of the KeePass entry to be ssh://hostname and it will run putty -ssh {USERNAME}@{hostname} for you. You can also set up a per-entry override using Entry > Properties > Override URL, which completely ignores the URL field and instead runs the command or pseudo-protocol defined there.

icons

* if your executable has an icon, just use the executable in the ICON field * If you want to pick a specific icon from an .exe or .dll, use "path\to\file.dll,4" or whichever icon number it is. See the various Icon tools above to determine icon number If they call it #201, then you use "...\file.dll,-201" If you use the positive integer N, then it is the Nth icon in the list (starting at N=0) * If you have an icon file (.ico) on your harddrive, you can just use the path to that .ico file. * For VERBS (the actions such as Open Command Window Here, see below), use the "Icon" entry in a given key * If you need to use a %EnvironmentVariable% to find the path, you need that default key to be REG_EXPAND_SZ instead of RegEdit's default REG_SZ * example: REG ADD HKCR\Directory\Background\Shell\NirSoftRrefresh /v Icon /t REG_EXPAND_SZ /d ^%ExampleVariable^%\iconfile.ico /f rem' /v is the name of the entry rem' /t allows you to specify the type (REG_EXPAND_SZ) rem' /d is the data rem' /f forces an overwrite if it exists (and allows you to change to REG_EXPAND_SZ) rem' the ^ before the % escapes the %, so %ExampleVariable% isn't expanded when we write the registry * For FILETYPE ASSOCIATIONS, use Key=FileTypeHandler\DefaultIcon's (Default) value (or Key=...\Software\Classes\Applications\appname.exe\DefaultIcon's value), putting the path to the icon * If you need to use a %EnvironmentVariable% to find the path, you need that default key to be REG_EXPAND_SZ instead of RegEdit's default REG_SZ * see the examples from perl, such as REG ADD HKCR\PerlScript\DefaultIcon /ve /t REG_EXPAND_SZ /d %ExampleVariable%\iconfile.ico /f rem' /ve indicates we are changing the (DEFAULT) value, rather than a sub-item for the KEY rem' /t allows you to specify the type (REG_EXPAND_SZ) rem' /d is the data rem' /f forces an overwrite if it exists (and allows you to change to REG_EXPAND_SZ) rem' the ^ before the % escapes the %, so %ExampleVariable% isn't expanded when we write the registry * The standard windows icon lists are found in %windir%\system32\shell32.dll and %windir%\system32\imageres.dll. (SuperUser has a answer listing those and other less-common icon repositories.)

verbs

Special Variables

Special Variables for VERB commands => for meanings of %1, %L, %V, %W, ....

Open Command Window Here

Should be available by default as Shift-RightClick
If so, in the HKCR or HKLM variants below, just change name of "Extended" string to "No-Extended" or "Orig-Extended" or "Extended-Orig" (or delete it) to make it global. The below instructions give the full, final-values
If you need to add them, or Windows won't give you write permission, use the HKCU variant instead

HKCU\Software\Classes\Directory\Background\Shell → This is the context-menu when clicking in the empty space in a directory Key = ComandHere (or similar) (Default) = STRING = @shell32.dll,-8506 → This accesses the string#8506 from shell32.dll. "Open Command Window Here". Use NirSoft\ResourcesExtract on shell32.dll and select STRINGS to discover all sorts of other builtin strings Icon = STRING = %SystemRoot%\system32\cmd.exe No-Extended = STRING = (EMPTY) → Required to get it to show up in RightClick menu, without using fancy ctrl-shift-RightClick NoWorkingDirectory = STRING = (EMPTY) command\(Default) = STRING = cmd.exe /s /k pushd "%V" WIN10: HideBasedOnVelocityId = rename to ShowBasedOnVelocityId (https://superuser.com/a/1155338/537128) -- old version said HKCR\... or HKLM\SOFTWARE\Classes\... Do the same for HKCU\Software\Classes\Directory\Shell → Context-menu when clicking on the name of a directory HKCU\Software\Classes\DesktopBackground\Shell → Context-menu when clicking on your Desktop HKCU\Software\Classes\Drive\Shell → Context-Menu when clicking on the name/letter of a Drive HKCU\Software\Classes\Folder\Shell → Context-Menu in a Library -- old version said HKCR\... or HKLM\SOFTWARE\Classes\... DO NOT do it for HKCU\Software\Classes\LibraryFolder\Shell → Context-Menu for a Folder icon in the main Windows Explorer view for the Libraries HKCU\Software\Classes\LibraryLocation\Shell → Context-Menu for a subdirectory when accessed from a LibraryFolder You actually can create Shell keys in the LibraryFolder, but if you do, you need to set the (Default) action to "open". Still, probably better to avoid it on these two. (smile) https://web.archive.org/web/20150711091443/http://windowsxp.mvps.org/context_folders.htm gives the order that Registry keys are processed, for Directories, Files, and specific variants of those. Directories/Folders [HKCU\Software\Classes\Folder\Shell\] [HKCU\Software\Classes\Folder\ShellEx\ContextMenuHandlers\] [HKCU\Software\Classes\Directory\Shell\] [HKCU\Software\Classes\Directory\ShellEx\ContextMenuHandlers\] [HKCU\Software\Classes\AllFilesystemObjects\shell\] [HKCU\Software\Classes\AllFilesystemObjects\shellex\ContextMenuHandlers\] Notes: my experiments show that something in the treeview will show what's in the "Directory" before "Folder"; and that something in the main Explorer panel (file/folder view) will show what's in Folder before Directory Drives [HKCU\Software\Classes\Drive\Shell\] [HKCU\Software\Classes\Folder\Shell\] [HKCU\Software\Classes\Drive\ShellEx\ContextMenuHandlers\] [HKCU\Software\Classes\Folder\ShellEx\ContextMenuHandlers\] Files [HKCU\Software\Classes\<ProgID>\shellex\ContextMenuHandlers\] [HKCU\Software\Classes\*\shellex\ContextMenuHandlers\] [HKCU\Software\Classes\*\shell\] [HKCU\Software\Classes\AllFilesystemObjects\shellex\ContextMenuHandlers\] As a batch file, converted to HKCU\Software\Classes\ instead of HKCR\: @echo off rem Directory\Background REG ADD HKCU\Software\Classes\Directory\Background\shell\OpenCommandWindowHere /ve /d "Open Command Window Here (HKCU\Software\Classes\Directory\Background)" /F REG ADD HKCU\Software\Classes\Directory\Background\shell\OpenCommandWindowHere /v Icon /t REG_EXPAND_SZ /d "%%SystemRoot%%\system32\cmd.exe" /F REG ADD HKCU\Software\Classes\Directory\Background\shell\OpenCommandWindowHere /v NoExtended /t REG_SZ /d "" /F REG ADD HKCU\Software\Classes\Directory\Background\shell\OpenCommandWindowHere /v NoWorkingDirectory /t REG_SZ /d "" /F REG ADD HKCU\Software\Classes\Directory\Background\shell\OpenCommandWindowHere\command /ve /d "cmd.exe /s /k pushd \"%%V\"" /F REG QUERY HKCU\Software\Classes\Directory\Background\shell\OpenCommandWindowHere\ /S rem Directory REG ADD HKCU\Software\Classes\Directory\shell\OpenCommandWindowHere /ve /d "Open Command Window Here (HKCU\Software\Classes\Directory)" /F REG ADD HKCU\Software\Classes\Directory\shell\OpenCommandWindowHere /v Icon /t REG_EXPAND_SZ /d "%%SystemRoot%%\system32\cmd.exe" /F REG ADD HKCU\Software\Classes\Directory\shell\OpenCommandWindowHere /v NoExtended /t REG_SZ /d "" /F REG ADD HKCU\Software\Classes\Directory\shell\OpenCommandWindowHere /v NoWorkingDirectory /t REG_SZ /d "" /F REG ADD HKCU\Software\Classes\Directory\shell\OpenCommandWindowHere\command /ve /d "cmd.exe /s /k pushd \"%%V\"" /F REG QUERY HKCU\Software\Classes\Directory\shell\OpenCommandWindowHere\ /S rem DesktopBackground REG ADD HKCU\Software\Classes\DesktopBackground\shell\OpenCommandWindowHere /ve /d "Open Command Window Here (HKCU\Software\Classes\DesktopBackground)" /F REG ADD HKCU\Software\Classes\DesktopBackground\shell\OpenCommandWindowHere /v Icon /t REG_EXPAND_SZ /d "%%SystemRoot%%\system32\cmd.exe" /F REG ADD HKCU\Software\Classes\DesktopBackground\shell\OpenCommandWindowHere /v NoExtended /t REG_SZ /d "" /F REG ADD HKCU\Software\Classes\DesktopBackground\shell\OpenCommandWindowHere /v NoWorkingDesktopBackground /t REG_SZ /d "" /F REG ADD HKCU\Software\Classes\DesktopBackground\shell\OpenCommandWindowHere\command /ve /d "cmd.exe /s /k pushd \"%%V\"" /F REG QUERY HKCU\Software\Classes\DesktopBackground\shell\OpenCommandWindowHere\ /S rem Drive REG ADD HKCU\Software\Classes\Drive\shell\OpenCommandWindowHere /ve /d "Open Command Window Here (HKCU\Software\Classes\Drive)" /F REG ADD HKCU\Software\Classes\Drive\shell\OpenCommandWindowHere /v Icon /t REG_EXPAND_SZ /d "%%SystemRoot%%\system32\cmd.exe" /F REG ADD HKCU\Software\Classes\Drive\shell\OpenCommandWindowHere /v NoExtended /t REG_SZ /d "" /F REG ADD HKCU\Software\Classes\Drive\shell\OpenCommandWindowHere /v NoWorkingDrive /t REG_SZ /d "" /F REG ADD HKCU\Software\Classes\Drive\shell\OpenCommandWindowHere\command /ve /d "cmd.exe /s /k pushd \"%%V\"" /F REG QUERY HKCU\Software\Classes\Drive\shell\OpenCommandWindowHere\ /S rem Folder REG ADD HKCU\Software\Classes\Folder\shell\OpenCommandWindowHere /ve /d "Open Command Window Here (HKCU\Software\Classes\Folder)" /F REG ADD HKCU\Software\Classes\Folder\shell\OpenCommandWindowHere /v Icon /t REG_EXPAND_SZ /d "%%SystemRoot%%\system32\cmd.exe" /F REG ADD HKCU\Software\Classes\Folder\shell\OpenCommandWindowHere /v NoExtended /t REG_SZ /d "" /F REG ADD HKCU\Software\Classes\Folder\shell\OpenCommandWindowHere /v NoWorkingFolder /t REG_SZ /d "" /F REG ADD HKCU\Software\Classes\Folder\shell\OpenCommandWindowHere\command /ve /d "cmd.exe /s /k pushd \"%%V\"" /F REG QUERY HKCU\Software\Classes\Folder\shell\OpenCommandWindowHere\ /S rem refresh nircmd shellrefresh nircmd sysrefresh To do the converse (open explorer window from current directory in command window) c:\> explorer . Administrator Version: Same as above, but... Key = runas required name to give it the elevated permissions HasLuaShield = "" Here's a script which does it all reg add HKCR\Directory\Background\shell\runas /ve /d "Open Admin Command Window Here" /f reg add HKCR\Directory\Background\shell\runas /v Icon /d ^%SystemRoot^%\system32\cmd.exe /f reg add HKCR\Directory\Background\shell\runas /v HasLUAShield /d "" /f reg add HKCR\Directory\Background\shell\runas /v No-Extended /d "" /f reg add HKCR\Directory\Background\shell\runas /v NoWorkingDirectory /d "" /f reg add HKCR\Directory\Background\shell\runas\command /ve /d "cmd.exe /s /k pushd \"^%V\"" /f reg add HKCR\Directory\shell\runas /ve /d "Open Admin Command Window Here" /f reg add HKCR\Directory\shell\runas /v Icon /d ^%SystemRoot^%\system32\cmd.exe /f reg add HKCR\Directory\shell\runas /v HasLUAShield /d "" /f reg add HKCR\Directory\shell\runas /v No-Extended /d "" /f reg add HKCR\Directory\shell\runas /v NoWorkingDirectory /d "" /f reg add HKCR\Directory\shell\runas\command /ve /d "cmd.exe /s /k pushd \"^%V\"" /f reg add HKCR\DesktopBackground\shell\runas /ve /d "Open Admin Command Window Here" /f reg add HKCR\DesktopBackground\shell\runas /v Icon /d ^%SystemRoot^%\system32\cmd.exe /f reg add HKCR\DesktopBackground\shell\runas /v HasLUAShield /d "" /f reg add HKCR\DesktopBackground\shell\runas /v No-Extended /d "" /f reg add HKCR\DesktopBackground\shell\runas /v NoWorkingDirectory /d "" /f reg add HKCR\DesktopBackground\shell\runas\command /ve /d "cmd.exe /s /k pushd \"^%V\"" /f reg add HKCR\Drive\shell\runas /ve /d "Open Admin Command Window Here" /f reg add HKCR\Drive\shell\runas /v Icon /d ^%SystemRoot^%\system32\cmd.exe /f reg add HKCR\Drive\shell\runas /v HasLUAShield /d "" /f reg add HKCR\Drive\shell\runas /v No-Extended /d "" /f reg add HKCR\Drive\shell\runas /v NoWorkingDirectory /d "" /f reg add HKCR\Drive\shell\runas\command /ve /d "cmd.exe /s /k pushd \"^%V\"" /f reg add HKCR\Folder\shell\runas /ve /d "Open Admin Command Window Here" /f reg add HKCR\Folder\shell\runas /v Icon /d ^%SystemRoot^%\system32\cmd.exe /f reg add HKCR\Folder\shell\runas /v HasLUAShield /d "" /f reg add HKCR\Folder\shell\runas /v No-Extended /d "" /f reg add HKCR\Folder\shell\runas /v NoWorkingDirectory /d "" /f reg add HKCR\Folder\shell\runas\command /ve /d "cmd.exe /s /k pushd \"^%V\"" /f

Subfolder

With some work, you can add subfolders (cascading menus). HKCU\Software\Classes\*\Shell\3.ExtraNotepad++ ExtendedSubCommandsKey [REG_SZ] MySubmenus\ExtraNotepad++ Icon [REG_EXPAND_SZ] "%ProgramFiles%\Notepad++\notepad++.exe",1 MUIVerb [REG_SZ] Notepad++ Extras HKCU\Software\Classes\MySubmenus\ExtraNotepad++ Shell 0.NewInstance Icon [REG_EXPAND_SZ] "%ProgramFiles%\Notepad++\notepad++.exe",-1537 MUIVerb [REG_SZ] Open in New Instance command (Default) [REG_SZ] "C:\Program Files\Notepad++\notepad++.exe" -multiInst -nosession "%1" 1.FolderAsWorkspace Icon [REG_EXPAND_SZ] "%ProgramFiles%\Notepad++\notepad++.exe",-202 MUIVerb [REG_SZ] Open Folder as Workspace command (Default) [REG_SZ] "C:\Program Files\Notepad++\notepad++.exe" -multiInst -nosession -openFoldersAsWorkspace "%W" 1.AsSession Icon [REG_EXPAND_SZ] "%ProgramFiles%\Notepad++\notepad++.exe",-1536 MUIVerb [REG_SZ] Open As Session command (Default) [REG_SZ] "C:\Program Files\Notepad++\notepad++.exe" -openSession "%1"

Refresh after Registry Edit

After editing the registry (or similar actions), it's nice to make sure Windows is refreshed.

Make a batch file in the same directory as nircmd: c:\usr\local\apps\NirSoft\refresh.bat:

@c:\usr\local\apps\NirSoft\nircmd shellrefresh @c:\usr\local\apps\NirSoft\nircmd sysrefresh

Run the following once to set up right-click commands to execute it

reg add HKCU\Software\Classes\Directory\Background\shell\NirSoftRefresh\command /ve /d "c:\usr\local\apps\NirSoft\refresh.bat" /f reg add HKCU\Software\Classes\Directory\shell\NirSoftRefresh\command /ve /d "c:\usr\local\apps\NirSoft\refresh.bat" /f reg add HKCU\Software\Classes\DesktopBackground\shell\NirSoftRefresh\command /ve /d "c:\usr\local\apps\NirSoft\refresh.bat" /f reg add HKCU\Software\Classes\Drive\shell\NirSoftRefresh\command /ve /d "c:\usr\local\apps\NirSoft\refresh.bat" /f reg add HKCU\Software\Classes\*\shell\NirSoftRefresh\command /ve /d "c:\usr\local\apps\NirSoft\refresh.bat" /f echo icons reg add HKCU\Software\Classes\Directory\Background\shell\NirSoftRefresh /v Icon /d "shell32.dll,-16739" /f reg add HKCU\Software\Classes\Directory\shell\NirSoftRefresh /v Icon /d "shell32.dll,-16739" /f reg add HKCU\Software\Classes\DesktopBackground\shell\NirSoftRefresh /v Icon /d "shell32.dll,-16739" /f reg add HKCU\Software\Classes\Drive\shell\NirSoftRefresh /v Icon /d "shell32.dll,-16739" /f reg add HKCU\Software\Classes\*\shell\NirSoftRefresh /v Icon /d "shell32.dll,-16739" /f

If you change the icon and want Windows to refresh, you can log out and back on, or send the SHChangeNotify; here is example code which does that:

/* https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shchangenotify REMARKS => Applications that register new handlers of any type must call SHChangeNotify with the SHCNE_ASSOCCHANGED flag to instruct the Shell to invalidate the icon and thumbnail cache. SHCNE_ASSOCCHANGED A file type association has changed. SHCNF_IDLIST must be specified in the uFlags parameter. dwItem1 and dwItem2 are not used and must be NULL. This event should also be sent for registered protocols. */ #include <windows.h> #include <Shlobj.h> int main(int argc, char ** argv) { SHChangeNotify( SHCNE_ASSOCCHANGED , SHCNF_IDLIST , NULL , NULL ); return(0); }

Copy as Full Path

This allows you to copy the full path of the file Two options: 1. Shift-RightClick | Copy as Path * this uses CLSID\{f3d06e7c-1e45-4a26-847e-f9fcdee59be0} * This HowTo Geek article <http://www.howtogeek.com/forum/topic/copying-the-path-of-a-file-to-the-clipboard-in-windows-vista> and the CLSID's ContextMenuOptIn StringValue entry seem to imply that you might be able to do something... but I couldn't delete/rename the ContextMenuOptIn like I could the Extended 2. or follow this AskVG article <http://www.askvg.com/registry-tweak-to-add-copy-as-path-option-in-files-and-folders-context-menu-in-windows/> to use Windows' built-in clip.exe and some command-line tricks to copy the path to the clipboard, and add the call to the normal (non-Shift) RightClick shell ContextMenu * To add an icon, add a new Value to the "HKCR\AllFilesystemObjecs\shell\Copy as Path": Icon = "shell32.dll,-16763" → #16763 is the Windows clipboard. (image not available; see the result of the batch below for final value) * Run the following once to implement the above: reg add HKCR\AllFilesystemObjects\shell\CopyAsFullPath /ve /d "Copy as Full Path" /f reg add HKCR\AllFilesystemObjects\shell\CopyAsFullPath /v Icon /d "shell32.dll,-16763" /f reg add HKCR\AllFilesystemObjects\shell\CopyAsFullPath\command /ve /d "cmd.exe /c (echo.|set /p=\"\"%1\"\")|clip.exe" /f

new file

Customized Context-menu > New > FileType

Use NirSoft:FileTypesMan > F2 (Edit Selected File Type) > CHK "Show this file type in the 'New' menu of Explorer" -> NullFile NirSoft:ShellMenuNew lists the entries for "New", but doesn't let you edit or create ones https://superuser.com/questions/34704/how-can-i-add-an-item-to-the-new-context-menu -> FileName FileName = "blah.pl" => place blah.pl in %UserProfile%\Templates (mine), %AllUsersProfile%\Templates (ours), or %SystemRoot%\ShellNew (global) Apparently, %UserProfile%\Templates is now a junction, and you need to access it through %AppData%\Microsoft\Windows\Templates ... http://msdn.microsoft.com/en-us/library/windows/desktop/cc144101%28v=vs.85%29.aspx .EXT\ShellNew\ REG_SZ:Command = executes app (ie, launch wizard) REG_BINARY:Data = binary/text to use as contents of new file REG_SZ:FileName = raw name from %profile% locations mentioned above, or full path to template file REG_SZ:NullFile = ignores value; just creates a zero-byte file If you have two file extensions that map to the same type (like .txt and .log both map to type="txtfile"), you can use a different ShellNew key, but both will show up in the NEW list under the same name (based on the FileType text) Ooh, ItemName subkey may help with that. => nope, didn't help, in the experiments I tried. (sad)

sorting explorer

Sorting the TreeView in Windows Explorer

It is possible to change the order of Libraries vs. Local Machine, etc (learned on Windows 10 setting up at home, but seems to work in Windows 7, too): https://superuser.com/questions/616708/rearranging-items-in-windows-8-1-navigation-pane/948922 HKCR\CLSID\{...} HKCR\Wow6432Node\CLSID\{...} => {031E4825-7B94-4dc3-B131-E946B44C8DD5} = Libraries => {8E74D236-7F35-4720-B138-1FED0B85EA75} = OneDrive (aka SkyDrive) => {20D04FE0-3AEA-1069-A2D8-08002B30309D} = This PC (w8,w10) or Computer {w7} no SortOrderIndex in SU tag http://www.eightforums.com/tutorials/13591-clsid-key-guid-shortcuts-list-windows-8-a.html => shows more CLSID for the different items... might be able to sort some others look at laptop's CLSID, searching for SortOrderIndex => {323CA680-C24D-4099-B94D-446DD2D7249E} = Favorites ---- (---) aka Quick List or whatever, from Win10 To remove Favorites from Explorer, <http://www.techrepublic.com/blog/windows-and-office/remove-favorites-from-windows-explorer-in-windows-7/> Change ShellFolder:Attributes[DWORD] from 0xA0900100 to 0xA9400100 Try adding SortOrderIndex = 0x57 to put it after ThisPC * had to change the owner to me (was Trusted Installer), then add permissions to administrator to be able to change it. -> doesn't move it Try the Attributes change, with logoff/on => made it disappear * but even after re-enable and add SortOrderIndex, then reboot, still stayed at the top; oh, well. => {031E4825-7B94-4dc3-B131-E946B44C8DD5} = Libraries 0x42 (66d) => {B4FB3F98-C1EA-428d-A78A-D1F5659CBA93} = Other Users Folder 0x43 (67d) aka HomeGroup => {6785BFAC-9D2D-4be5-B7E2-59937E8FB80A} = Other Users Folder 0x44 (68d) aka HomeGroup => {450D8FBA-AD25-11D0-98A8-0800361B1103} = <???> 0x48 (72d) => {4336a54d-038b-4685-ab02-99bb52d3fb8b} = Public Folder 0x4c (76d) => {20D04FE0-3AEA-1069-A2D8-08002B30309D} = Computer ---- (xxx) aka This PC => {A8A91A66-3A7D-4424-8D24-04E180695C7A} = Device Center 0x58 (88d) aka Devices/Printers => {F02C1A0D-BE21-4350-88B0-7367FC96EF3C} = Computers/Devices 0x58 (88d) aka Network => {5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0} = Control Panel ---- (---) aka Control Panel command object for Start menu and desktop => {645FF040-5081-101B-9F08-00AA002F954E} = Recycle Bin 0x78 (120d)

Saving the Sort Order for a particular folder

Windows has a default "View" (Details, Big Icons, etc) and "Sort Order" (Date, Extension, Date+Name, ...) based on the Folder Type (General, Photos, ...). But it's also supposed to remember on a per-folder basis. It uses the "BagMRU" to store this, but there are only 5000 slots, and they can fill up more quickly than you might expect.

ms office

The Microsoft Office Suite (Word, Excel, Outlook ...) has Quick Access Toolbars along the top, above or below the Menus/Ribbons, which have commands that stay there, no matter which Ribbon is selected. These are easily-configurable using the Customize Quick Access Toolbar >> More Commands... feature. Other tools (the applets, such as MSPaint and WordPad) also have QAT, but they are slightly harder to customize: you have to edit an XML-encoded entry in the registry (regedit again).

ms paint

For MSPaint, the registry entry is HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Paint\Ribbon:QatItems. Copy the contents into Notepad++, or other XML-aware editor, tweak, and paste back into the registry. (Thanks to this article for helping me find the registry name.) I use Save, Save As, Undo, Redo, Image Properties (width, height), New, Open, Print, Customize. Here is my XML (note, there are no newlines in the registry entry; used only for readability here). <siq:customUI xmlns:siq="http://schemas.microsoft.com/windows/2009/ribbon/qat"> <siq:ribbon minimized="false"> <siq:qat position="0"> <siq:sharedControls> <siq:control idQ="siq:20004" visible="true" argument="0" insertBeforeQ="siq:20002"/><!-- save --> <siq:control idQ="siq:20006" visible="true" argument="0" insertBeforeQ="siq:20002"/><!-- save as --> <siq:control idQ="siq:31001" visible="true" argument="0" insertBeforeQ="siq:20002"/><!-- undo --> <siq:control idQ="siq:31002" visible="true" argument="0" insertBeforeQ="siq:20002"/><!-- redo --> <siq:control idQ="siq:20019" visible="false" argument="0" insertBeforeQ="siq:20002"/><!-- email --> <siq:control idQ="siq:20026" visible="true" argument="0" insertBeforeQ="siq:20002"/><!-- properties --> <siq:control idQ="siq:20002" visible="true" argument="0"/><!-- new --> <siq:control idQ="siq:20003" visible="true" argument="0"/><!-- open --> <siq:control idQ="siq:20014" visible="true" argument="0"/><!-- print --> <siq:control idQ="siq:20017" visible="false" argument="0"/><!-- preview --> </siq:sharedControls> </siq:qat> </siq:ribbon> </siq:customUI>

word 2010

For the Office Suite applications, the QAT is edited via Customize QAT >> More Commands >> All Commands.

I use Save, Save As, Undo, Redo, Switch Windows, Page Setup, "Print Preview and Print"

In other Word customizations, I do File >> Options >> Proofing >> Autocorrect Options: I turn Math AutoCorrect always-on (makes it easier to enter math symbols). Make sure the following symbols are defined in the Math AutoCorrect:

** = × .* = ∙ *.* = *.* $$ = § -> = → => = ⇒ <- = ← \boxempty = ☐ \boxcheck = ☑ \boxex = ☒ \checkmark = ✓ \exmark = ✗ \us = μs \uA = μA \degc = °C \degC = °C \degf = °F \degF = °F \Ohm = Ω \ohm = Ω

Customize Ribbon >> Enable the Developer Tab: This makes it much easier to record macros and use VBA (Visual Basic for Applications).

Customize Ribbon >> Font -> All Commands >> "Strikethrough" >> ADD: this makes it easy to add strikethrough text.

To allow Word to trust macros in files from My Documents (or other such area): File >> Options >> Trust Center >> Trust Center Settings >> Trusted Locations >> Add New Location, and enter your path, and select whether or not to trust subfolders.

Word's Trust Center Settings are reset when you convert from Office 2010 to Office 365 (2013)

excel 2010

Save, Save As, Undo, Redo, Switch Windows, Page Setup, "Print Preview and Print".

File >> Options >> Proofing >> Autocorrect Options >> Math Autocorrect: I do the same mappings as I added to Word.

The Excel Insert >> Symbols doesn't have a SHORTCUT KEY configuration. I just use Math AutoCorrect or manually Insert >> Symbol.

Customize Ribbon >> Enable the Developer Tab: This makes it much easier to record macros and use VBA (Visual Basic for Applications).

Customize Ribbon >> Home >> Font >> New Group: "Font" or some short name; move the new "Font (Custom)" Group next to the original "Font" Group. (Unfortunately, unlike Word, Excel does not allow you to add to a pre-existing Group.) All Commands >> "Strikethrough" >> ADD into "Font (Custom)". All Commands >> Symbol... >> ADD into "Font (Custom)".

To allow Excel to trust macros in files from My Documents (or other such area): File >> Options >> Trust Center >> Trust Center Settings >> Trusted Locations >> Add New Location, and enter your path, and select whether or not to trust subfolders.

Unlike Word, Excel's Trust Center Settings are not reset when you convert from Office 2010 to Office 365 (2013).

word and excel 2013/2016/365

Mostly keeps your settings from before If you don't like the "home page", and want to go straight to an empty document or spreadsheet File >> Options >> General >> Start up options >> uncheck "Show Start screen when this application starts" Per http://blog.dabasinskas.net/few-registry-tweaks-for-office-2013-customer-preview/, you can edit HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common\General and set DisableBootToOfficeStart = 1 to disable it globally in all Office 365 (2013) applications Word/Excel Avatar: in the upper right of Word/Excel windows, there's a blank avatar; it's more complicated to update than the Outlook Email Avatar Office365 Avatar: Word or Excel >> File >> Account >> User Information >> Change Photo: this will take you to your online Office365 profile (https://maximintegrated-my.sharepoint.com/) From the webpage, click on the avatar >> Change Photo: this will take you to your Edit Details page From the Edit Details, click on Change Your Photo: this will pop up a new window, where you can actually upload a photo. This takes a long time to propagate through the Office 365 website family. But I never saw it fully propagate to the Word/Excel, even after 24 hrs (googling shows that these updates are supposed to propagate within 12-24hrs) Actual Word/Excel Avatar RegEdit >> HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common\Identity\Identities\user.name@maximintegrated.com_AD (your Active Directory SSO user.name) Photo = a REG_BINARY that should include a 96x96 JPEG image; mine said something like No Photo when I read it in the RegEdit binary editor. PhotoExpires = REG_SZ "2015-12-16T15:36:38Z" = Expiration Timestamp in GMT Once it hits the expiration date, it goes and looks at your Active Directory entry, and resets the Photo and PhotoExpires registry values based on what's in the database.

outlook 2010

I like being able to look at message headers. QAT ... All Commands >> Message Options and Added it to the panel.

I also like the Out Of Office toolbar easily accessible (I can never find it in the default location). But, to make it stand out, I put it on the main Ribbon instead. Right Click on the HOME Ribbon >> Customize Ribbon; on the right, under Main Tabs >> Home (Mail), add a New Group named OutOfOffice, and select All Commands >> Automatic Replies from the left and add it to your OutOfOffice group.

In individual e-mails, I also like to be able to look at the headers, or sometimes at the whole message source (when trying to confirm whether an embedded HTML hyperlink really goes where it claims, or if it's a spam link to a copycat site). Thus, open up a message window, and Customize QAT >> More Commands >> All Commands >> Message Options and >> View Source. (I haven't found a way to View Source from the main Outlook list/preview view, only from an open message.)

Also, see the auto-correct options for Word 2010, which are accessed in Outlook through File >> Options >> Mail >> Spelling and Autocorrect >> Autocorrect Options

outlook 2013/2016/365

For Outlook, there are some settings you can influence the panes:

View Current View >> View Settings >> Other Settings Column Font = sets the column headers Row Font = sets the email-list/table font Grid Line Style = allows visual separation between rows in the table, or not Show items in Groups = will group by dates Reading Pane = Right/Bottom/Off Show messages from all folders in expanded conversation groups = use this if you like "threading" your e-mail View >> Messages >> Show as Conversations shows conversations in just this folder (I think) View >> Arrangement >> Message Preview Off will give the truly compact style, where you just have the list of e-mails, without the first line or 3 of message-body being displayed in the table Set your email avatar People (used to be called "contacts") select yourself in the details on the right, look for View Source: Outlook (Contacts) next to your name, there should be an avatar icon; click it and load your image Navigation Bar Defaults Huge Select ... | Navigation Options | Compact Navigation to compress it Inline Reply (http://blog.dabasinskas.net/few-registry-tweaks-for-office-2013-customer-preview/) There is a new behavior: when you hit REPLY within the main Outlook window, instead of the separate email reading window, it will edit your reply INLINE – inside your main Outlook Window's Preview Pane If you prefer editing the email in a separate window, you can click the Pop Out button. Or you can make new-window editing the default: RegEdit >> Office 2013 = HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Message Office 2016 = HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Message Set DisableReadingPaneCompose REG_DWORD = 1

office 365 themes

For "themes", there are only three: blindingly white ("white"), blindingly gray ("light gray"), and less-blindingly gray ("dark gray"); google tell me that there's not much we can do about this. 2016 "improved" this to black, white, light gray, and colorful. File >> Office Account >> "Office Theme" is what sets this globally across 365. File >> Options >> General >> "Personalize" is what sets this per-application

word 365: per file Ribbon customizations

If you customize the Ribbon in Word 365, it will go into your global settings. This conversation implies it can be done on a per-file basis, and this how-to guide gives a solution, using their Office RibbonX Editor tool to easily add the customUI XML, and hooks to it, in the right place in the document.

Confirmed: if I follow the steps in the how-to guide, I am able to get custom ribbons; and if I export my global custom ribbon, and then clean it up to just stuff shown in that example, and add size="large", I can get a menu that looks/works identical to my existing global custom ribbon.

Here are Wayback Machine links to the old MSDN articles that they linked to, which have references on how to use it:

other notes:

Specifications: The schema URL in the customUI.xml header isn't a valid webpage, so you cannot look at the underlying schema. However, I found some links that appear to be the official learn.microsoft documentation for the v1 and v2 CustomUI files:

edge browser

desktop

cmd.exe

(really, cmd.exe and filesystem stuff)

page look-and-feel inspired by lifehacker.me