August 26, 2016

8 Surprising Windows Notepad Tricks You Must Know

We can all agree that the Windows Notepad is basic and usually gets shunted out in favor of feature-filled alternatives. But Notepad is more powerful than it looks and we’ll introduce you to some of its hidden tricks. Soon, you’ll want to keep this ancient Windows program handy at all times by turning Notepad into a sticky note.
Note: These tricks have been around from the time of Windows 7. I have tested all of them on Windows 10 as well. They still work!

 

1. Use Notepad as a Journal

Did you know that you can program Notepad to add a timestamp? This makes it perfect for adding journal entries when you have a few minutes to spare during the day.
To get an automatic timestamp, create a new text document, type in .LOG, and save the file. The next time you open the file, you should see the current date and time appear within it. Hit Enter, start recording your thoughts, and save them. As expected, every time you open the file, a fresh timestamp appears.



notepad-journal

If you want to add a quick timestamp on the fly, you could take a shortcut and hit F5 instead. This corresponds to the Time/Date item hidden in the Edit menu.

 

2. Get Line Count

You’d like to view the number of lines in a Notepad document and you know that you’ll have to display the status bar for that. But a quick peek at the View menu shows you that the Status Bar option is grayed out, if you’re not on Windows 10 that is. What do you do now? It’s simple — head to the Format menu and turn off Word Wrap. Now you should be able to display the status bar from the View menu, and once you do, you can see the line count as well.
To jump to a specific line, hit CTRL + G to bring up the Go To Line dialog, type in the line number you’d like to jump to, and hit Enter. This works even if you haven’t displayed the line count, because Notepad’s numbering system is active at all times.

notepad-line-count

If you’d like to keep the status bar active all the time, i.e. with or without the Word Wrap option disabled, you’ll need to delve into the Windows registry and edit a specific key value. At this point we should warn you that if you tweak the wrong registry setting, it could mess up your Windows installation. To know what you’re getting into, read our guide on how to use the Windows registry and how not to accidentally mess up the registry.
Ready to proceed? Great! Enter regedit into Windows search and hit Enter to open the Registry Editor. Next, look for the following key using the sidebar navigation: HKEY_CURRENT_USER\Software\Microsoft\Notepad. Once you have it selected in the sidebar, double-click on StatusBar in the right-side panel. Done? Now in the dialog box that has popped up, change the DWORD value from 0 to 1.

persistent-status-bar

 

3. Add a Header and a Footer

If you want to insert a header and/or a footer into a Notepad document, go to File > Page Setup…. In the dialog box that opens up, look for the Header: and Footer: fields and type in the content that you want to display in the header and footer.

notepad-header-footer

Can’t see the header and footer in the document itself? Don’t worry — that’s how it’s meant to be. Those elements will show up when you print the file.
Since there’s no way to save the header/footer content from the Page Setup dialog, you’ll have to add it manually every time you print the file. Also, you can’t set up different headers and footers in Notepad like you can in Microsoft Word and other word processors.
What’s cool about this Notepad feature is that using a few special commands, you can insert the filename, a timestamp, and page numbers in the header/footer and even align its contents left, right, or center. Here’s a snapshot of the commands you get to use:
header-footer-commands
For example, if you want to display the current date (&d) and time (&t) on the left (&l) and the file name (&f) on the right (&r) in the header, this is the text that you’ll need to paste into the Header: field: &l&d&t&r&f

 

4. Find the Windows Product Key

The easiest way to retrieve your Windows product key is by looking it up on the printed sticker that you’ll find on some part of your laptop or desktop, usually on the base or at the back. If that sticker is worn out or inaccessible, that’s not a problem. You can still retrieve the key from the Windows registry, as long as you haven’t formatted the hard drive, of course.
To view the product key on your computer screen, you can use a third-party program like Belarc Advisor or even a Visual Basic (VB) script that retrieves the key from the registry. We’ll show you how to create such a script. First, open up a fresh Notepad document and paste in the following bit of code:



Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))

Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
Cur = 0
x = 14
Do
Cur = Cur * 256
Cur = Key(x + KeyOffset) + Cur
Key(x + KeyOffset) = (Cur \ 24) And 255
Cur = Cur Mod 24
x = x -1
Loop While x >= 0
i = i -1
KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
If (((29 - i) Mod 6) = 0) And (i <> -1) Then
i = i -1
KeyOutput = "-" & KeyOutput
End If
Loop While i >= 0
ConvertToKey = KeyOutput
End Function



Now save the file using the extension .vbs (instead of .txt). And that’s the VB script that will give you the product key when you run it! To run the script, double-click on the .vbs file that you just created and saved. You’ll then see a popup window with your product key. Hit CTRL + C if you’d like to copy the key.


windows-product-key

 

5. Test Your Antivirus Software

Want to find out if your computer’s antivirus program is working okay? You can use what is known as the EICAR test file to do the checking for you. Don’t worry, that’s not a virus-laden file we’re unleashing on your computer. It’s a simple text file that you’ll be creating in Notepad, with the following piece of harmless code saved to it:
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
Your virus scanner should pick this file up as a virus and deal with it accordingly. If it does, it’s a sign that the antivirus program is working as expected. Of course, this does not guarantee that you’re protected from all viruses.


eicar-test

 

6. Create a Password-protected Folder

With this trick, the idea is to create a deceptive file that you can use to unlock and reveal a secret folder as and when you need it.
To begin with, create a new Notepad document and paste this code into it:


cls
@ECHO OFF
title Folder Private
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Private "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%== your_password goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Private
echo Private created successfully
goto End
:End



Replace your_password in the code above with a password of your choice and save the file as a Batch file named locker.bat. I’ll digress a bit here to point out that you can automate various repetitive tasks with Batch files.
When you run the locker.bat file (by double-clicking on it) for the first time, it creates a folder named Private in the same location as the .bat file. This folder is where you can stash away any files and folders that you’d like to keep to yourself.
Now run the locker.bat file again. This asks you whether you want to lock the file. Hit Y, followed by Enter to confirm. You’ll see that the Private folder is no longer visible.


folder-locker


To access the folder again, run locker.bat and when prompted, enter your password (the one you added to the code while saving the .bat file). If you have forgotten the password, drag and drop the locker.bat file into Notepad to view the password.
This trick is fun, but it’s not foolproof — anyone who knows where to look and what to tweak can find the secret folder with ease. To display the secret folder yourself without running locker.bat, go to Folder Options > View and…
  • …uncheck the box next to Hide protected operating system files,
  • check the radio button for Show hidden files, folders, and drives.
The folder might show up with the name Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D} instead of Private.

 

7. Remove Formatting from Text Snippets

Copy-pasting text snippets from one app to another comes with the problem of messed-up formatting. It’s better to paste in unformatted text and then format it using styles from the app that you’re pasting into.
To do so, you’ll first need to strip the formatting from the copied text. The quickest way to do that? Use CTRL + SHIFT + V to paste unformatted text directly or, you could first paste the text into Notepad, which supports only plain text, and copy-paste it from there.
Of course, that’s just one way to strip formatting when you copy-paste text.


8. Make Your Computer Speak

You can get your computer to read a piece of text to you with a simple VB script that we’ll create using Notepad. Begin with a new document and paste in the code given below:
Dim message, sapi
message=InputBox("Repeat after me")
Set sapi=CreateObject("sapi.spvoice")
sapi.Speak message



Use the File > Save As command to save the file with the extension .vbs. Now when you open the saved file, you’ll get a dialog box with a blank text field. Type in something for your computer to read aloud and hit OK. You’ll also want to take a look at these five other ways to get your Windows computer to read to you.
In the code above, you can replace the text Repeat after me with a message of your choice and that is what you’ll see as a prompt in the dialog box when you run the script.


text-to-speech

Notepad Magic

Who knew Notepad was capable of all these tricks? It has stayed more or less the same over the years, but it has turned out to be cooler than we thought.
Do you have a Notepad trick or two up your sleeve? Share it with us!Source: http://www.makeuseof.com/tag/8-surprising-windows-notepad-tricks-must-know/