Don't try to use these functions if you do not have administrator rights.
For safety sake I have not included a function to swap the shell system-wide as changing the shell system-wide will render ALL your accounts useless if something goes wrong.
I highly recommend creating a new user with admin rights first, then setting explorer as the default shell for all users seperately and then telling the system to use the shell settings per user, instead of using a system-wide setting.
And only then, if everything is working properly with explorer, changing your shell for an alternative one.
This ensures you have a fail safe account if things go wrong.
When the code below is run "as is" it only performs the check without making any changes.
If the check returns 0 something unknown to me is running your shell and I recommend not using these functions unless you are absolutely.. positively.. sure what you are doing.
The correct order of usage is:
Run this code and note the number returned.
If CheckSystemWide() returns 2 (per user settings are in effect)
You can proceed directly to point 3] below.
If CheckSystemWide() returns 1 (system-wide setting is in effect)
1]
Log into each user account and use SetExplorer4User()
This will set explorer as the default shell for the current user.
This will have no effect untill you execute UseUserShells() (step 2)
Note! Do this for all users seperately BEFORE proceding to step 2.
2]
Log back in as administrator and use UseUserShells() in order to instruct
windows to use the seperate user entries instead of the system-wide setting.
Reboot... if life is still wonderfull you should see your normal windows startmenu etc. as provided by explorer
3]
If at this point you are still smiling instead of scratching your head and pulling out your hair,
the time is ripe to change the shell for the current user only by using SetOtherShell4ThisUser(shell)
Make sure to pass the full path to your shell to the function.
The function SetExplorer4All() is provided as a failsafe as it re-sets your system to use explorer system-wide and tells it to provide the normal start-menu, tray etc.
If you are an extremely carefull/paranoid person you might want to compile this function as a seperate exe, just in case.
Note! when copying and pasting this code beware of additional linefeeds that might be there as a result of this posting.
RegRead, RegWrite's and comments should be on a single line.
Feedback is greatly appreciated, if somebody wants to test this on windows XP please report your findings in this forum so we can all benefit, it should work but I don't (yet) have access to windows XP nor do I plan to "upgrade" my trusted windows2000.
And last but not least, clearly you are using this code at your own responsibility.
; if this function returns 0 something strange is going on, in which case I advice against using any of the functions below SystemWide := CheckSystemWide() MsgBox, %SystemWide% CheckSystemWide() ; check if a single shell is set for all users, 1 if yes, 2 if windows uses shells as per user and 0 if something unknown to me is entered ; usage: SystemWide := CheckSystemwide() { RegRead, SystemWide, HKLM, SOFTWARE\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot, shell IfInString,SystemWide,SYS: return 1 IfInString,SystemWide,USR: return 2 return 0 } SetExplorer4User() ; sets explorer as the shell for the current user ; usage: SetExplorer4User() { ; the DesktopProcess 0 setting ensures that explorer will provide the startmenu, desktop etc. RegWrite, REG_DWORD, HKLM, Software\Microsoft\Windows\CurrentVersion\Explorer, DesktopProcess, 0 RegWrite, REG_DWORD, HKLM, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, DesktopProcess, 0 RegWrite, REG_DWORD, HKLM, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\DesktopProcess, DefaultValue, 0 RegWrite, REG_DWORD, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer, DesktopProcess, 0 RegWrite, REG_DWORD, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, DesktopProcess, 0 ; the BrowseNewProcess setting ensures that explorer starts a new process everytime it is run and increases stabily, uses more memory though RegWrite, REG_SZ, HKLM, Software\Microsoft\Windows\CurrentVersion\Explorer\BrowseNewProcess, BrowseNewProcess, yes ; now set explorer as the shell for the current user RegWrite, REG_SZ, HKCU, Software\Microsoft\Windows NT\CurrentVersion\Winlogon, shell, Explorer.exe ; the entry below ensures that windows will automatically try to restart the shell if it crashes (windows default setting) RegWrite, REG_DWORD, HKLM, SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon, AutoRestartShell, 1 } UseUserShells() ; instruct windows to use a shell as set per user ; !!!!!!!!!!! make absolutely sure a shell is set for each user on the system before using this function !!!!!!!!!!!!!!!! ; usage: UseUserShells() { ; instruct windows to use a shell as set per user RegWrite, REG_SZ, HKLM, SOFTWARE\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot, shell, USR:software\Microsoft\Windows NT\CurrentVersion\Winlogon ; the entry below ensures that windows will automatically try to restart the shell if it crashes RegWrite, REG_DWORD, HKLM, SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon, AutoRestartShell, 1 } SetOtherShell4ThisUser(shell) ; sets the given shell as the shell for the current user ; usage: SetOtherShell4User("C:\MyShell\MyShell.exe") ; just to be sure always enter a full path { ; the DesktopProcess 1 setting ensures that explorer will NOT provide the startmenu, desktop etc. (note the one) RegWrite, REG_DWORD, HKLM, Software\Microsoft\Windows\CurrentVersion\Explorer, DesktopProcess, 1 RegWrite, REG_DWORD, HKLM, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, DesktopProcess, 1 RegWrite, REG_DWORD, HKLM, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\DesktopProcess, DefaultValue, 1 RegWrite, REG_DWORD, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer, DesktopProcess, 1 RegWrite, REG_DWORD, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, DesktopProcess, 1 ; the BrowseNewProcess setting ensures that explorer starts a new process everytime it is run and increases stabily, uses more memory though RegWrite, REG_SZ, HKLM, Software\Microsoft\Windows\CurrentVersion\Explorer\BrowseNewProcess, BrowseNewProcess, yes ; now set the shell for the current user RegWrite, REG_SZ, HKCU, Software\Microsoft\Windows NT\CurrentVersion\Winlogon, shell, %shell% ; the entry below ensures that windows will automatically try to restart the shell if it crashes RegWrite, REG_DWORD, HKLM, SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon, AutoRestartShell, 1 } SetExplorer4All() ; set explorer for all users (the normal default). More of a fail-safe(restore) function ; usage: SetExplorer4All() { ; (re-)set explorer as the system-wide shell RegWrite, REG_SZ, HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon, shell, Explorer.exe ; the DesktopProcess 0 setting ensures that explorer will provide the startmenu, desktop etc. RegWrite, REG_DWORD, HKLM, Software\Microsoft\Windows\CurrentVersion\Explorer, DesktopProcess, 0 RegWrite, REG_DWORD, HKLM, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, DesktopProcess, 0 RegWrite, REG_DWORD, HKLM, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\DesktopProcess, DefaultValue, 0 RegWrite, REG_DWORD, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer, DesktopProcess, 0 RegWrite, REG_DWORD, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, DesktopProcess, 0 ; now instruct the system to use the system-wide shell (allusers) RegWrite, REG_SZ, HKLM, SOFTWARE\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot, shell, SYS:Microsoft\Windows NT\CurrentVersion\Winlogon ; the entry below ensures that windows will automatically try to restart the shell if it crashes RegWrite, REG_DWORD, HKLM, SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon, AutoRestartShell, 1 }