The component in Windows that executes JScript is the Windows Script Host (WSH).
In part, Microsoft is to blame for hiding the file type portion of file names by default.
Then, you can safely experience Windows Script Host running a JScript file by double-clicking on the file in Windows Explorer.
As shown above, the execution will fail because the variable "b" is not defined. The following are instructions to have Notepad process
.js files rather than the Windows Script Host.
In Windows 7, right click on the
disableme.js file, then click on "Open With." To the right of "Other Programs" is a small arrow pointing down. Click on it, then click on Notepad and OK. In my testing, the checkbox "Always use the selected program to open this kind of file" was checked by default. Still, you should verify that the box is checked.
In Windows 8, right click on the
disableme.js file, then click on "Open with," then "More options" and finally on Notepad.
In Windows 10, right click on the
disableme.js file, then click on "Open with." The default here seems to be different than Windows 7, so you will need to turn on the checkbox for "Always use this app to open .js files." Then click on "More apps," Notepad and the OK button.
To verify that notepad is indeed the default program for handling .js files, just double click on the
disableme.js file again.
We're not done yet, however.
Windows also treats ".jse" files as JScript and the Windows Script Host processes them too. So, rename the "
disableme.js" file to "
disableme.jse" and repeat the above procedure.
Some, perhaps many, people can stop right here. But, for those who care, we can dial the protection up to 11.
Windows Script Host has both a text mode and GUI mode. You can verify that the text mode is functioning by opening a command prompt and entering "
cscript." The output above, which is slightly truncated, is from Windows 7, but it is almost exactly the same on Windows 8 and 10.
To verify that the GUI mode is functional, open a command prompt and enter "
wscript." On Windows 7, 8 and 10, a new window should be displayed that looks like the one above.
Microsoft does not provide a simple way to disable WSH, we have to hack around in the registry. Articles from Tend Micro and F-Secure offer the details. Different registry keys can disable WSH for a single user or system-wide.
Before modifying the registry, it is a good idea to make a Restore Point, which backs up the registry. After modifying it to disable WSH, you can verify that it worked by running the two commands above.
Finally, some editorializing.
Reading email on a Windows computer is like swimming in shark infested waters. The safest environment for email is a Chromebook. If you don't like your email providers webmail system, then look for a Chromebook that will soon be able to run Android apps, giving you a wide choice of email clients.
Do yourself and the world a favor by not reading email on a Windows machine.