It's always been a way to create a new code file with a new text file, right-click, but there's a problem. The newly created file is 0 bytes in size. For file files that are 0 bytes in size, the text editor generally uses MBCS encoding, and MBCS encoding is not good for cross-system, cross-editor use of files.
First look at the Windows system "right-click New" mechanism.
1. Open the Registration form
2. Expand HKEY_CLASSES_ROOT
3. Find the. txt subkey, expand it, and the secret is to shellnew this subkey. All extensions with Shellnew subkeys will appear in the New Right-click menu
4. Click the Shellnew subkey, and in the right jack there is a string value filename, extension string value itemname. The following on my machine:
Explain the specific meanings of these two values:
1. FileName the template file for the new file, which is in the @%systemroot%\shellnew directory. All new text files are copies of the Newtext.txt.
2. ItemName the name of the new menu item "Right-click," Notepad.exe the value of the No. 470 string resource, as follows:
Small partners should have thought of how to achieve the requirements of the topic.
1. Open the Newtext.txt file with Notepad, and users in Vista and above remember to run Notepad using administrator mode
2. Click on the Notepad menu "file-Save as"
3. In the "Encode (E)" option, select UTF-8 and click "OK"
4. Get it done and try it quickly.
Like to toss a small partner can also try to modify the contents of the Newtext.txt file.
Original address: http://www.jianshu.com/p/e956eaae8828
Let Windows create a new UTF-8 encoded text file