How to determine if Windows shows file extensions by PowerShell

Introduction

This sample provides a script for IT pro or windows customers to quickly determine if Windows shows file extensions by PowerShell.

Scenarios

Users might have an option to display/hide file extensions when viewing files on Windows. They only need to call the script, and then they will find the current setting of this option.

Script

Input the name of the script, and option of display/hide file extensions will be shown on the console as the below screenshot.

 

 

PowerShell
编辑脚本|Remove
$HideFileExt = (Get-ItemProperty -LiteralPath 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -ErrorAction Stop).'HideFileExt' 
IF($HideFileExt -eq 0 ){"Show extensions for know file types" } ELSE {"Hidden extensions for know file types"}

 

Microsoft All-In-One Script Framework is an automation script sample library for IT Professionals. The key value that All-In-One Script Framework is trying to deliver is Scenario-Focused Script Samples driven by IT Pros' real-world pains and needs. The team is monitoring all TechNet forums, IT Pros' support calls to Microsoft, and script requests submitted to TechNet Script Repository. We collect frequently asked IT scenarios, and create script samples to automate the tasks and save some time for IT Pros. The team of All-In-One Script Framework sincerely hope that these customer-driven automation script samples can help our IT community in this script-centric move.