How to get the current screensaver on Windows? - windows

Either using Regedit or using command prompt, I need to learn the active screensaver file. Without using the screensaver settings window, of course.

reg query "HKCU\Control Panel\Desktop" -v sc*
HKEY_CURRENT_USER\Control Panel\Desktop
ScreenSaveActive REG_SZ 1
ScreenSaverIsSecure REG_SZ 0
ScreenSaveTimeOut REG_SZ 300
SCRNSAVE.EXE REG_SZ C:\WINDOWS\system32\Mystify.scr
End of search: 4 match(es) found.
Above code works for standard Windows screensavers (defined as follows and Blank); didn't try Photos.
reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Screensavers"
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Screensavers\Bubbles
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Screensavers\Mystify
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Screensavers\Ribbons
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Screensavers\ssText3d
Possible executables:
where *.scr
C:\Windows\System32\Bubbles.scr
C:\Windows\System32\Mystify.scr
C:\Windows\System32\PhotoScreensaver.scr
C:\Windows\System32\Ribbons.scr
C:\Windows\System32\scrnsave.scr
C:\Windows\System32\ssText3d.scr

Related

Updating Image File Execution Options with reg command, why is both 64but and 32bit keys updated?

I'm updating Image File Execution Options with reg command
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "\"c:\windows\Notepad2.exe\" /z" /f
And both 64bit keys and 32bit keys are updated, why?
And if delete the wow6432node key with regedit, the 64bit key is gone as well.
Does anyone know what's happening?

Can I Assign a Custom Icon to a File Type

Is there a way i can associate a file type like (.php, .css, .js) to a custom icon, even when the file has been associate with a program.
for example on my computer .php is associated to sublime text, and when i encounter .php on my file system it show ST's icon, is there a way to make it change to a custom icon like the good ol' elephant, but still be associated with ST i.e when i click the file it still open's in ST(== sublime text).
I know how to do it for filetypes assigned to Notepad++.
In Windows 10, Notepad++ keeps hijacking the icons of filetypes that you open (by default) in Notepad++. It was very difficult to break that behaviour, but I finally got it working!
Preparations
1. Registry permissions
Open the Windos registry, and give yourself enough "permissions" for the folders HKEY_CLASSES_ROOT and HKEY_CURRENT_USER. I'm not sure myself what are the minimum settings for the whole procedure to succeed. You've got to play a bit with the settings. Anytime you get an error message in the coming procedure, go back to this step and increase your registry permissions.
2. Make some custom icons
Make some custom icons, for example in the folder C:\ICONS\. I use the following website https://iconverticons.com/online/ to convert 256x256 png-files into ico-files.
3. Install Notepad++
Just get Notepad++. Nothing special here.
4. Open a terminal with admin rights
Type cmd in the windows search bar. Right click on the CMD-icon that appears and choose "Run as administrator" in the popup window.
Registry hacking
Disclaimer: changing your registry can potentially cause damage to your Windows installation. I have written down the procedure below with best intentions, but I deny any responsibility in case something goes wrong.
Note: I DON'T recommend to use this procedure for .bat files. This is a very important file-type for Windows. So I don't know what would happen if you delete its standard registry keys.
The procedure below describes how to assign a custom icon - which you created in C:\ICONS\abcfile.ico - to all *.abc files.
1. Registry hacking, part one
The first registry key you should add is HKEY_CLASSES_ROOT\.abc. In case this key already exists, you might want to delete it. Use the following command to delete the key and all its subkeys:
> REG DELETE HKEY_CLASSES_ROOT\.abc /f
The following figure shows how we will (re)build this registry key and all its subkeys:
You can do it manually or run the following commands:
> REG ADD HKEY_CLASSES_ROOT\.abc /ve /t REG_SZ /d "abc_auto_file"
> REG ADD HKEY_CLASSES_ROOT\.abc /v BrowserFlags /t REG_DWORD /d 0x00000000
> REG ADD HKEY_CLASSES_ROOT\.abc /v EditFlags /t REG_DWORD /d 0x00000000
> REG ADD HKEY_CLASSES_ROOT\.abc /v PerceivedType /t REG_SZ /d "text"
> REG ADD HKEY_CLASSES_ROOT\.abc\DefaultIcon /ve /t REG_SZ /d "C:\ICONS\abcfile.ico,0"
2. Registry hacking, part two
The second registry key you should add is HKEY_CLASSES_ROOT\abc_auto_file. In case this key already exists, you might want to delete it. Use the following command to delete the key and all its subkeys:
> REG DELETE HKEY_CLASSES_ROOT\abc_auto_file /f
The following figure shows how we will (re)build this registry key and all its subkeys:
You can do it manually or run the following commands:
> REG ADD HKEY_CLASSES_ROOT\abc_auto_file /ve /t REG_SZ
> REG ADD HKEY_CLASSES_ROOT\abc_auto_file\DefaultIcon /ve /t REG_SZ /d "C:\ICONS\abcfile.ico"
> REG ADD HKEY_CLASSES_ROOT\abc_auto_file\shell /ve /t REG_SZ
> REG ADD HKEY_CLASSES_ROOT\abc_auto_file\shell\edit /ve /t REG_SZ
> REG ADD HKEY_CLASSES_ROOT\abc_auto_file\shell\edit\command /ve /t
> REG_EXPAND_SZ /d "\"C:\Program Files (x86)\Notepad++\notepad++.exe\" \"^%1\""
> REG ADD HKEY_CLASSES_ROOT\abc_auto_file\shell\open /ve /t REG_SZ
> REG ADD HKEY_CLASSES_ROOT\abc_auto_file\shell\open\command /ve /t
> REG_EXPAND_SZ /d "\"C:\Program Files (x86)\Notepad++\notepad++.exe\" \"^%1\""
3. Registry hacking, part three
The second registry key you should add is HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.abc. In case this key already exists, you might want to delete it. Use the following command to delete the key and all its subkeys:
> REG DELETE HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.abc /f
The following figure shows how we will (re)build this registry key and all its subkeys:
You can do it manually or run the following commands:
> REG ADD HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.abc /ve /t REG_SZ
> REG ADD HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.abc\OpenWithList /ve /t REG_SZ
> REG ADD HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.abc\OpenWithProgids /ve /t REG_SZ
> REG ADD HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.abc\OpenWithProgids /v "C:\Program Files (x86)\Notepad++\notepad++.exe" /t REG_NONE /d 0
> REG ADD HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.abc\OpenWithProgids /v abc_auto_file /t REG_NONE /d 0
Refresh icon cache
The following command should refresh the Windows icon cache:
> %windir%\system32\ie4uinit.exe -show
Assign Notepad++ to the filetype
I've noticed that - sometimes - the changes only take effect after assigning Notepad++ as the default program to open the filetype.
This is how to do that:
Create a file with the given filetype, eg: myFile.abc
Right click on the file, and select "open with" >> "another app"
You should get a popup window like:
Select Notepad++ as the default program
Finish
Normally the icon has changed now! And all files of that particular filetype will have the custom icon. They will open by default in Notepad++.
Perhaps you should again refresh the icon cache:
> %windir%\system32\ie4uinit.exe -show
or restart your system to let it take effect (although restarting wasn't needed for me).

How to set value in registry via batch file in Windows?

I am going to set a value to windows registry.
I want to set variable shit for StupidMS in registry, but the result is wrong. Following is my code.
set stupidMS=shit
echo %stupidMS%
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /v "StupidMS" /t REG_SZ /d ^%stupidMS^%
I think the problem is ^%stupidMS^%, but I quite have no idea how to correct it.
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /v "StupidMS" /t REG_SZ /d "%stupidMS%"

How to make Unicode charset in cmd.exe by default?

866 charset installed by default in Windows' cmd.exe is poor and inconvinient as compared with glorious Unicode.
Can I install Unicode by default or replace cmd.exe to another console and make it default so programms use it instead of cmd.exe?
I understand that chcp 65001 changes encoding only in the running console. I want to change charset at the system level.
After I tried algirdas' solution, my Windows crashed (Win 7 Pro 64bit) so I decided to try a different solution:
Start Run (Win+R)
Type cmd /K chcp 65001
You will get mostly what you want. To start it from the taskbar or anywhere else, make a shortcut (you can name it cmd.unicode.exe or whatever you like) and change its Target to C:\Windows\System32\cmd.exe /K chcp 65001.
Open an elevated Command Prompt (run cmd as administrator).
query your registry for available TT fonts to the console by:
REG query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont"
You'll see an output like :
0 REG_SZ Lucida Console
00 REG_SZ Consolas
936 REG_SZ *新宋体
932 REG_SZ *MS ゴシック
Now we need to add a TT font that supports the characters you need like Courier New, we do this by adding zeros to the string name, so in this case the next one would be "000" :
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont" /v 000 /t REG_SZ /d "Courier New"
Now we implement UTF-8 support:
REG ADD HKCU\Console /v CodePage /t REG_DWORD /d 65001 /f
Set default font to "Courier New":
REG ADD HKCU\Console /v FaceName /t REG_SZ /d "Courier New" /f
Set font size to 20 :
REG ADD HKCU\Console /v FontSize /t REG_DWORD /d 20 /f
Enable quick edit if you like :
REG ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f
Save the following into a file with ".reg" suffix:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe]
"CodePage"=dword:0000fde9
Double click this file, and regedit will import it.
It basically sets the key HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe\CodePage to 0xfde9 (65001 in decimal system).
For me, for Visual Studio 2022, it worked when I executed this ".reg" command.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console\C:_Program Files_Microsoft Visual Studio_2022_Professional_Common7_IDE_CommonExtensions_Platform_Debugger_VsDebugConsole.exe]
"CodePage"=dword:0000fde9
It is based on #Shaohua Li's answer: https://stackoverflow.com/a/24711864/2941313. It does the same thing but for different path (specifically for VS2022 console).

Not sure why REG ADD command line does not run in VS setup post build event

In the post-build Event, I have had the following command line,
REG ADD HKLM\SOFTWARE\Microsoft\Office\12.0\Common\General /v EnableLocalMachineVSTO /t REG_DWORD /d 1
, which adds a DWORD type value under the registry key General.
I don't know what else I am missing here - the command line REG ADD just doesn't seem to work for me. After the installation, that key is still missing. If I run it alone using Command Prompt, it's all good though.
There is some issue with visual studio build events.
Even with admin privilege, it cannot register in HKLM.
instead if u try with HKEY_CURRENT_USER, it works great.
REG ADD HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\12.0\Common\General /v EnableLocalMachineVSTO /t REG_DWORD /d 1

Resources