Windows edit file type

GetFileType function (fileapi.h)

Retrieves the file type of the specified file.

Syntax

Parameters

A handle to the file.

Return value

The function returns one of the following values.

Return code/value Description
FILE_TYPE_CHAR 0x0002 The specified file is a character file, typically an LPT device or a console.
FILE_TYPE_DISK 0x0001 The specified file is a disk file.
FILE_TYPE_PIPE 0x0003 The specified file is a socket, a named pipe, or an anonymous pipe.
FILE_TYPE_REMOTE 0x8000 Unused.
FILE_TYPE_UNKNOWN 0x0000 Either the type of the specified file is unknown, or the function failed.

В

You can distinguish between a «valid» return of FILE_TYPE_UNKNOWN and its return due to a calling error (for example, passing an invalid handle to GetFileType) by calling GetLastError.

If the function worked properly and FILE_TYPE_UNKNOWN was returned, a call to GetLastError will return NO_ERROR.

If the function returned FILE_TYPE_UNKNOWN due to an error in calling GetFileType, GetLastError will return the error code.

Remarks

In WindowsВ 8 and Windows ServerВ 2012, this function is supported by the following technologies.

Show and change file extensions in Windows 10

Do you have trouble change file extensions on Windows computer? In an earlier post, we discussed how to convert Samsung voice recording files from 3GA to MP3 format, a couple of readers wrote to us saying “how can you rename a file (the extension) because I can’t see file extensions, I can only rename the ‘normal’ name.” It is true with most Android phones, you can only rename file on mobile but can’t edit file extensions unless you have installed the file explorer, see how to change file extensions on Samsung and Android phones. Today, we will be using Windows 10 in the demo to show you how to display file extensions and change file extension in Windows 10. File extensions of known file types are hidden on Windows 10 PC by default. Only those file types that are not associated with some software installed in your computer display file extensions after file names. This seems to be easier to use for average users. However this could be confusing as well. Many Windows 10 users are confused as file extensions can be found in some files not another. In this guide, we will show you quick ways to turn off “Hide extensions for known file types” feature of File Explorer in Windows 10 so you will not see some files have extensions, other files do not and this allows you to change file extensions in Windows 10.

How to show file extensions and change file extensions in Windows 10?

In order to edit file extensions in Windows 10, you need to change the File Explorer settings to display file extensions first. Open File Explorer in Windows 10 or any folder on your computer hard drive, then switch to the View tab in upper menu to view ribbon menu. Click to check the box before File name extensions option to enable file extension display in Windows 10. Now you can see those hidden file extensions in Windows explorer, including those common file types and file extensions like .exe, .doc, .docx, .xlsx, .jpg, .png, .mp3, mp4, .wmv, etc.

Читайте также:  There is no windows installer service

To show file extensions in Windows 10, you can also click the Options button as shown in the upper right corner, then disable the “Hide extensions for known file types” in windows 10 from File Explorer Options as shown below.

Now you can go to change a file name extension within Windows File Explorer. Simply double click a file name then edit file extensions as you like on Windows 10 PC. Alternatively you can right click on the file you like to edit, then choose Rename from the context menu on right click to start changing file extension for the selected file in Windows 10.

Batch change file extensions in Windows 10

Have you ever wanted to change a group of files file extensions in Windows 10? For example, you want to change 100 audio files with .amr extension to .mp3. You do not have to change file extensions one by one. You can make use of the Windows Command Prompt to batch change file extensions on Windows 10 PC.

Firstly create a new folder on your computer. For example, we can create a folder named ‘test’ on hard drive D. Put all those .amr files to this new folder. Then open the Command Prompt in Windows 10. You can right click on the Windows logo at the bottom-left corner of the screen, then choose Command Prompt to open Command Prompt in Windows 10 or simply type CMD in the search box at the bottom-left corner to find and open Command Prompt in Windows 10.

Secondly we need to change path to the created folder in Command Prompt. By default it opens the user folder. Type “d:” without the quotes and press Enter to change to another disk. Type “cd test” and hit Enter to change the current working directory to the “test” folder where all the files you want to change file extensions are saved.

Finally type “ren *.* *.xxx” and hit Enter to change all files’ extension to .xxx. For example, if you want to change them to mp3 files, use the command “ren *.* *.mp3”.

Windows 10 has been released for some time. We have found many new features in this latest Windows OS such as the Edge browser, new Start menu, etc. We also noticed some features have been removed, such as the DVD playback support, now you need to manually download a free DVD Player for Windows 10.

Update May 2018: this article was originally published in Sep 2015 and has since been updated. in this update, we added the new method to batch change file extensions for multiple files in Windows 10.

How to Change the Icon for a File Type in Windows?

It’s surprising that Windows doesn’t have a built-in option to allow users to set custom icons for file types. If you have a custom file type and the corresponding program doesn’t have a nice-looking icon in its .exe or .dll resource, you can change or customize the default icon for that file type manually.

This article explains how to change the default icon for a file type using different methods in Windows. Instructions apply to all versions of Windows, including Windows 10

How to Change the Default Icon for a File Type?

You can change the default icon for a file type using the built-in Registry Editor. In the second method, let’s see how to change the default icon using Default Programs Editor.

Method 1: Change file type icon using the Registry Editor

Let’s assume you want to change the file type icon for .txt files, and here is how to do that.

  1. Click Start, type regedit.exe and press ENTER
  2. Navigate to the following branch:
  3. In the right-pane, note down the value data for Progid (e.g. txtfile ). This is the user chosen (via Default Programs or Open with dialog) Programmatic Identifier for the file extension.

Registry Branch Not Found?

If the DefaultIcon key does not exist by default, you need to create it manually.

  • In the right-pane, double-click (default) and mention the path to your custom icon (.ico file or reference to a icon inside a EXE/DLL file. See “Icons From DLL/EXE Files” paragraph at the end of this article).
  • Edit the (default) value data, mentioning the path to a icon file. For this example, I used a notepad icon file from the web, saved it to a permanent location and mentioned the full path.If you’re using a custom icon file, make sure it’s at least 128 x 128, although it’s not a rule but this is to make sure icons look nice when folder view is set to large or extra large icons.
  • Exit the Registry Editor.
  • Logoff and login back, or refresh the icons and see if the Text file icons are now updated.
  • Icons From DLL/EXE Files

    If you don’t have a custom .ico file, you may use the icon picker dialog box to choose an icon from a EXE/DLL file. To launch the icon picker dialog, right-click on a folder in your system, click Properties. Click the Customize tab, and click Change Icon… button. Use the icon picker to choose the icon and make a note of the index. The index starts from “0” and you need to proceed vertically when counting (top to bottom.)

    Browse to shell32.dll or imageres.dll and note down the icon index, simply cancel the icon picker dialog and close folder properties dialog.

    For example, to set the 260 th icon in Shell32.dll, mention the following path, in Step 8:

    To make it clear, this procedure doesn’t change the file type associations, only the icon assigned to that file type. If the icons don’t update even if you restart Windows, clear and rebuild the icon cache.

    Additional note

    As the icon change is made to the ProgId txtfile in the registry, it also affects the other file extensions that use the same ProgId. For instance, in my system, the txtfile ProgID is being used by .log , .scp & .wtx file extensions. Those files will also show up with the new icon.

    To know which file extensions are using a ProgID (i.e., txtfile), run this command in the Command Prompt window:

    RELATED: See article How to Remove File Type Associations Using the Registry Editor for more information on File extension → ProgID mapping.

    It’s possible to change the default icon for a file type without affecting other file types. To do that, you’ll need to create a new file class or ProgID for the file extension, and assign the default icon in the newly created file class.

    Method 2: Change file type icon using Default Programs Editor

    Don’t want to edit the registry to change file type icons? There are 3rd party tools like Default Programs Editor and FileTypesMan that can change the file type icons and association settings.

    Default Programs Editor is a very useful tool which helps you to edit file type associations, add or remove AutoPlay handlers and static context menu entries. We’ve covered Default Programs Editor before. Default Programs Editor – A Useful File Association Editor for Windows

    In this method, let us see how you can accomplish the task using the Default Programs Editor.

    1. Download Default Programs Editor, unzip and run the executable.
    2. Select File Type Settings
    3. Click Icon
    4. Select the file extension for which you want to change the icon, in the next screen.
    5. This screen shows the current icon for the file type. To change it, click on the Browse button.
    6. In the icon picker dialog that’s displayed, browse and locate an icon, or point to a custom .ico file if you have one. The built-in imageres.dll and shell32.dll files contain many icons for you to choose from.
    7. Click the Save Icon button to save the changes to the registry.

    As you can see in the screenshot, you also have the option to save the settings to a file. In case you need to apply the changes to several computers, you can output the settings to a .REG file. This can be done by clicking the arrow mark near the Save Icon button, and choosing Save to .reg file. You can deploy or apply the .reg file on other computers without having to run the utility again.

    That’s it! The default icon for .txt file type is changed would now refresh or update automatically!

    [Before] .txt files showing standard icons [After] .txt files showing custom icons

    Method 3: Change file type icon using FileTypesMan

    FileTypesMan is an alternative to the Folder Options “File Types” tab (XP-era) in Windows. It displays the list of all file extensions and types registered on your computer. For each file type, the following information is displayed: Type Name, Description, MIME Type, Perceived Type, Flags, Browser Flags, and more. FileTypesMan also allows you to easily edit the properties and flags of each file type, as well as it allows you to add, edit, and remove actions in a file type. This utility works in all Windows versions including, Windows 10.

    Screenshots

    %SystemRoot%\system32\imageres.dll,-102 is the Windows-default icon for .txt files. Windows-default icon for .txt files

    After setting the default icon to %SystemRoot%\system32\imageres.dll,14 via the icon picker dialog, here is how it shows up: Customized .txt files icon

    Change the icon for unknown and extensionless files

    File types that are not registered with the system and files that have no extension are assigned a generic icon from shell32.dll,0 by default. The unknown or generic icon for unregistered file types and extensionless files can be customized as per your choice so that you don’t have to see the boring icon anymore.

    Windows stores the icon setting for unknown file types and extensionless files in this registry key:

    The (default) or the unnamed value points to the following icon resource by default:

    Using the Registry Editor (Regedit.exe), you can change the (default) value so that it points to a .ico file that you already have or an icon resource inside a .dll or .exe file by mentioning the file name and resource identifier.

    Using the Icon picker (a.k.a. the Change Icon dialog), you can use a relevant icon in shell32.dll, 224 that can be assigned for unregistered and extensionless files. You just need to replace the existing Value data ( %SystemRoot%\System32\shell32.dll,0 ) with %SystemRoot%\System32\shell32.dll,224 using the Registry Editor or using the REG files below.

    Logoff and login back to your account.

    Here is how it looked before:

    We’ve changed that to:

    Tip: In case the icons don’t automatically refresh even after a logoff-logon cycle, you can force a shell icons refresh using the ie4uinit.exe method or using Default Programs.

    Hope the above guide helped you change file type icons on your Windows 10 computer easily!

    Читайте также:  Драйвер для hp scanjet g2410 для windows 10 64 bit
    Оцените статью