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

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).

Related

How to get the current screensaver on 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

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).

Enabling developer mode on Windows 10 Build build 10074

Windows 10 Insider Preview build 10074 has a known issue using the Settings application to enable developer mode. In this build, if you try Settings/Update & Security/For developers... the settings window suddenly closes.
Is there a workaround?
Yes, there's a work-around. In an administrator command prompt, type the following commands:
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowAllTrustedApps" /d "1"
Then reboot the machine to enable developer mode

VS2013RC requires IE10 but i need (not want) IE8

I've been evaluating the VS2013preview since its release and was keen to install the RC. The problem is we need ie8 for legacy testing as many customers out in the field still use it.
As a possible workaround would it be possible to either, skip or fool the install package into thinking its installed? or install ie10 and then drop back to ie8 after installation?
I appreciate there may be some areas of things like browserlink to ie that I cannot use but this is OK as I mostly use chrome for initial dev work prior to testing in the various browsers.
Credit goes to Jimmy here, but here's a hack to make it work:
#ECHO OFF
:IE10HACK
REG ADD "HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer" /v Version /t REG_SZ /d "9.10.9200.16384" /f
REG ADD "HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer" /v svcVersion /t REG_SZ /d "10.0.9200.16384" /f
REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer" /v Version /t REG_SZ /d "9.10.9200.16384" /f
REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer" /v svcVersion /t REG_SZ /d "10.0.9200.16384" /f
GOTO EXIT
:REVERTIE
REG DELETE "HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer" /v svcVersion
REG DELETE "HKLM\SOFTWARE\Microsoft\Internet Explorer" /v svcVersion
REG ADD "HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer" /v Version /t REG_SZ /d "8.0.7601.17514" /f
REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer" /v Version /t REG_SZ /d "8.0.7601.17514" /f
GOTO EXIT
:EXIT
The problem is you're trying to use the same machine for developing and testing. Don't rely on the local copy of IE on your machine for testing a legacy browser, instead rely on virtual machine copies of Windows and run that specific browser.
If you want a quick & dirty way to test your stuff in specific versions of IE use the IETester as mentioned by others in the comments. http://my-debugbar.com/wiki/IETester/HomePage
You might want to consider simply using a virtual machine to run a copy of Windows with IE8 in it for your testing, since you don't really use it for day to day stuff anyways.
Microsoft announced yesterday that they are removing the requirement.
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/4153040-remove-the-requirment-for-internet-explorer-10-to-

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%"

Resources