...hello there :)...

search this blog

..traces left on one October 17, 2019 16:57

How You could benefit from file surnames?

post on:
Mood:

Files and folders are essential concepts with which You're most likely to deal using a computer. It's obvious that they have names - whereas it's not so obvious that they have also a kind of a last name. It's not obvious because files' "last names" are hidden by default - so You don't see them, and, in fact, You couldn't even have a clue that such a thing may exist.

Quick survey on what's coming:

  1. Why bother?
  2. How come this to be true?
  3. How to quickly uncover Your files' secrets?
  4. AutoHotkey approach.
  5. Alternative approach.
  6. Classic (Windows in-built) approach.

Why bother?

You could ask this question due to the fact that there is probably a reason to make file "surnames" hidden by default. One may suppose that such a reason is not to confuse an average user by additional information which seems not to be crucial. Unfortunately, the same average user may become a victim of a fraud, due to this approach. There are malicious files flying all over the Internet, being "in disguise" of completely ordinary stuff. For example, You may download a nice mp3 file from somewhere, and double-click it without knowing that it's not a mp3 file at all - it's just looks like that. It's very easy for a file to look any way, while being a completely different thing in the same time.

How come this to be true?

To understand this we need to go back to files' mysterious "surname" thing. A file "surname" is usually a three-letter string separated from the ordinary file name by a period. So if You've created and saved a file via Windows Notepad, You may end up with a file named, say, notes - while in fact its real and full name stands for notes.txt. The .txt part, hidden by default, tells You what kind of a file it really is (and, therefore, Your computer will know what app should be used to handle it).

The thing is it's easy to mislead people when they don't see this nature-revealing part. For example, one may create a virus and ascribe a well-known text file icon to it, so You will perceive it as just another ordinary text file, nothing special - while its real nature stays hidden in a form of a completely different "surname" than txt, docx or other text-related so-called extensions (which is a technical nomenclature for the "surnames" used in this article). So You may want to open this file, because why not? And boom, an unpleasant surprise comes in.

You wouldn't be willing to open this file, however, if You could just be able to see its real nature in plain view: instead of a sole notes - notes.txt, notes.docx, etc. What You need is just to find out which are the safe and predictable file extensions You have every rights to expect to see. Once You know this, You can't be mislead anymore, at least not so easily. Stumbling upon a file which looks like an ordinary text file as many similar ones on Your computer, You will be able to notice that it has an .exe or any other unexpected extension attached to it, and that it's enough to abandon the idea of opening it.

How to quickly uncover Your files' secrets?

Although You might think that a good solution should be to simply make "the surnames" visible - it's not always so obvious. There are people who still would prefer to have a clean and readable look when it comes to file lists (especially longer ones). Fortunately there is a way to reconcile the both: a clean file lists' look preserved - while files' real nature available close at hand (a simple keyboard shortcut to temporarily show file extensions - pressed another time it will hide them again).

There are various ways to prepare such a trick. One is to create an AutoHotkey script (it still fascinates Me how many things You can do with this tool). Another is to create a Virtual Basic script which will do without a need to install any additional app (in case You haven't installed AutoHotkey yet). There is also one more, let's call it "classic", method which does not involve creating any scripts at all - it utilizes native OS (Operating System) settings, scattered over several windows. But since it requires several clicks each and every time You need to switch file extensions on or off, it may not be the best choice to go. However, in case You don't wanna switch file extensions, but prefer to turn them on permanently - it does the best for You, because You don't need either to install any app or create any file with some code inside.

Let's go through each of those methods.

AutoHotkey approach.

Provided You have AutoHotkey installed, create a new text file, copy&paste the following code into it:

; WINDOWS KEY + Y TOGGLES FILE EXTENSIONS
#y::
RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt
If HiddenFiles_Status = 1 
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 0
Else 
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 1
WinGetClass, eh_Class,A
If (eh_Class = "#32770" OR A_OSVersion = "WIN_VISTA")
send, {F5}
Else PostMessage, 0x111, 28931,,, A
Return

and then save it as, say, switchFileExtensions.ahk.

Notice the ahk part included and separated from the rest of the file name with a dot: it informs Your computer that the file should be handled by AutoHotkey, instead of being treaded as ordinary text and opened with, say, Windows Notepad.

The original form of this script ascribes Win logo + Y (#y::) keyboard shortcut to switch file extensions' visibility (You need to refresh desktop or window's content to notice the changes). If You know how (You can learn it here), You can of course ascribe Your Own keys of preference instead of this one. Once You launch the script .ahk file, You'll be able to use the keyboard shortcut - till You turn-off Your computer. To make it always working, open the Autostart folder (under Windows 7 its location may look like this: C:\Users\YourUserName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup), hold the Alt key and drag'n'drop Your script file into the Autostart folder to create a shortcut to it there, which will launch the script automatically on every Windows startup.

Alternative approach.

If You don't prefer AutoHotkey, You can make things a little bit easier by using an in-built Windows script engine - Virtual Basic. There is one drawback, however: it doesn't provide You with the ability to switch file extensions via keyboard shortcut (instead of which You need to double-click the script file anytime You want to switch file extensions visibility). If You don't mind this anyway, create a text tile, copy&paste the following code into it:

FileExt = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt"
Set Sh = WScript.CreateObject("WScript.Shell")
St = Sh.RegRead(FileExt)
If St = 1 Then
Sh.RegWrite FileExt, 0, "REG_DWORD"
Else
Sh.RegWrite FileExt, 1, "REG_DWORD"
End If
Sh.SendKeys("{F5}")

and save it as, say, switchFileExtensions.vbs. Now, whenever You will need to show or hide file extensions, just double-click this file (and refresh the desktop or a folder's content to notice the changes).

Classic (Windows in-built) approach.

This method works best when all You want is to have file extensions always displayed. It will do both without any additional apps or script files.

Windows <10:

  1. Use Win logo + R, type control folders and confirm.
  2. In the new window switch to the View tab.
  3. Uncheck "Hide extensions of known file types",
  4. Confirm by Apply and OK.

Windows 10:

  1. Open File Explorer (Win key + E).
  2. Go to View tab on the ribbon menu.
  3. Check "File name extensions" under Show/hide section.

No comments:

Post a Comment