Privacy and Security Add "Hash value" to Context Menu of Files in Windows 11


Hash_banner.png

This tutorial will show you how to add "Hash value" to the context menu of files for all users in Windows 10 and Windows 11.

The Hash value context menu allows you to get the SHA1, SHA256, SHA384, SHA512, MACTripleDES, MD5, and/or RIPEMD160 hash values (checksum) of files.

The Hash value context menu uses the Get-FileHash cmdlet in PowerShell to compute the hash value for a file by using a specified hash algorithm. A hash value is a unique value that corresponds to the content of the file. Rather than identifying the contents of a file by its file name, extension, or other designation, a hash assigns a unique value to the contents of a file. File names and extensions can be changed without altering the content of the file, and without changing the hash value. Similarly, the file's content can be changed without changing the name or extension. However, changing even a single character in the contents of a file changes the hash value of the file.

The purpose of hash values is to provide a cryptographically-secure way to verify that the contents of a file have not been changed. While some hash algorithms, including MD5 and SHA1, are no longer considered secure against attack, the goal of a secure hash algorithm is to render it impossible to change the contents of a file -- either by accident, or by malicious or unauthorized attempt -- and maintain the same hash value. You can also use hash values to determine if two different files have exactly the same content. If the hash values of two files are identical, the contents of the files are also identical.

Reference:

While you must be signed in as an administrator to add or remove this context menu, all users can use the context menu.



EXAMPLE: "Hash value" context menu

In Windows 11, you will need to click/tap on Show more options first by default, then click/tap on Hash value.


Show_more_options.png
Hash_value_context_menu.png

Show_all_hash_values.png



Here's How:

1 Do step 2 (add) or step 3 (remove) below for what you want.

2 Add "Hash value" to Context Menu

A) Click/tap on the Download button below to download the file below, and go to step 4 below.​

Add_Hash_value_to_context_menu.reg


(Contents of .reg file)
Code:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\hash]
"MUIVerb"="Hash value"
"subCommands"=""


; MD5
[HKEY_CLASSES_ROOT\*\shell\hash\shell\01menu]
"MUIVerb"="MD5"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\01menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash -literalpath $file.substring(2,$file.length - 5) -algorithm MD5 ^| format-list; Start-Sleep 3600"


; SHA1
[HKEY_CLASSES_ROOT\*\shell\hash\shell\02menu]
"MUIVerb"="SHA1"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\02menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash -literalpath $file.substring(2,$file.length - 5) -algorithm SHA1 ^| format-list; Start-Sleep 3600"


; SHA256
[HKEY_CLASSES_ROOT\*\shell\hash\shell\03menu]
"MUIVerb"="SHA256"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\03menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash -literalpath $file.substring(2,$file.length - 5) -algorithm SHA256 ^| format-list; Start-Sleep 3600"


; SHA384
[HKEY_CLASSES_ROOT\*\shell\hash\shell\04menu]
"MUIVerb"="SHA384"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\04menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash -literalpath $file.substring(2,$file.length - 5) -algorithm SHA384 ^| format-list; Start-Sleep 3600"


; SHA512
[HKEY_CLASSES_ROOT\*\shell\hash\shell\05menu]
"MUIVerb"="SHA512"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\05menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash -literalpath $file.substring(2,$file.length - 5) -algorithm SHA512 ^| format-list; Start-Sleep 3600"


; MACTripleDES
[HKEY_CLASSES_ROOT\*\shell\hash\shell\06menu]
"MUIVerb"="MACTripleDES"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\06menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash -literalpath $file.substring(2,$file.length - 5) -algorithm MACTripleDES ^| format-list; Start-Sleep 3600"


; RIPEMD160
[HKEY_CLASSES_ROOT\*\shell\hash\shell\07menu]
"MUIVerb"="RIPEMD160"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\07menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash -literalpath $file.substring(2,$file.length - 5) -algorithm RIPEMD160 ^| format-list; Start-Sleep 3600"


; Allget-filehash -literalpath '%1' -algorithm RIPEMD160 | format-list
[HKEY_CLASSES_ROOT\*\shell\hash\shell\08menu]
"CommandFlags"=dword:00000020
"MUIVerb"="Show all"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\08menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $raw=[string]$input; $file=$raw.substring(2,$raw.length - 5); \\\"Path:`n$file`n\\\"; @(foreach ($a in @('MD5','SHA1','SHA256','SHA384','SHA512','MACTripleDES','RIPEMD160')) { get-filehash -literalpath $file -algorithm $a }) ^| foreach { \\\"$($_.Algorithm):`n$($_.Hash)`n\\\" }; Start-Sleep 3600"

3 Remove "Hash value" from Context Menu

This is the default setting.


A) Click/tap on the Download button below to download the file below, and go to step 4 below.​

Remove_Hash_value_from_context_menu.reg


(Contents of .reg file)
Code:
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\*\shell\hash]

4 Save the .reg file to your desktop.

5 Double click/tap on the downloaded .reg file to merge it.

6 When prompted, click/tap on Run, Yes (UAC), Yes, and OK to approve the merge.

7 You can now delete the downloaded .reg file if you like.


That's it,
Shawn Brink
 

Attachments

Last edited:
Insanely useful, thanks
 

My Computers

System One System Two

  • OS
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Dell G15 5525
    CPU
    Ryzen 7 6800H
    Memory
    32 GB DDR5 4800mhz
    Graphics Card(s)
    RTX 3050 Mobile 4GB Vram
    Monitor(s) Displays
    Gigabyte M27Q (rev. 2.0) 2560 x 1440 @ 170hz HDR
    Screen Resolution
    Internal laptop screen: 1920 x 1080 @ 120hz
    Hard Drives
    2TB Solidigm™ P41 Plus nvme
    Internet Speed
    800mbps down, 20 up
  • Operating System
    Chrome OS
    Computer type
    Laptop
    Manufacturer/Model
    HP Chromebook
    CPU
    Intel Pentium Quad Core
    Memory
    4GB LPDDR4
    Monitor(s) Displays
    14 Inch HD SVA anti glare micro edge display
    Hard Drives
    64 GB emmc

My Computers

System One System Two

  • OS
    Windows 11 Pro for Workstations
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom self build
    CPU
    Intel i7-8700K 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz (F4-3600C18D-32GTZR)
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING (11GB GDDR5X)
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    2 x Samsung Odyssey G75 27"
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Samsung 990 PRO M.2,
    4TB Samsung 990 PRO M.2,
    8TB WD MyCloudEX2Ultra NAS
    PSU
    Seasonic Prime Titanium 850W
    Case
    Thermaltake Core P3 wall mounted
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master 3
    Internet Speed
    1 Gbps Download and 35 Mbps Upload
    Browser
    Google Chrome
    Antivirus
    Microsoft Defender and Malwarebytes Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Galaxy S23 Plus phone
  • Operating System
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Surface Laptop 7 Copilot+ PC
    CPU
    Snapdragon X Elite (12 core) 3.42 GHz
    Memory
    16 GB LPDDR5x-7467 MHz
    Monitor(s) Displays
    15" HDR
    Screen Resolution
    2496 x 1664
    Hard Drives
    1 TB SSD
    Internet Speed
    Wi-Fi 7 and Bluetooth 5.4
    Browser
    Chrome and Edge
    Antivirus
    Windows Defender
Hey, I noticed that PowerShell throws an error when a file path contains a double space.

With a little search I found that if I replace
-literalpath \\\"%1\\\" with -literalpath '\"%1\"' it works fine.

I don't know if my method introduces any other issues because I noticed that you had changed your command from a previous version by replacing -literalpath '%1' with -literalpath \\\"%1\\\" and my solution kind of ignores that change.

(Also, unrelated and not that important, I noticed that the comment above the last "Show all" command is wrong.)
 

My Computer

System One

  • OS
    Windows 11 Pro
Hey, I noticed that PowerShell throws an error when a file path contains a double space.

With a little search I found that if I replace
-literalpath \\\"%1\\\" with -literalpath '\"%1\"' it works fine.

I don't know if my method introduces any other issues because I noticed that you had changed your command from a previous version by replacing -literalpath '%1' with -literalpath \\\"%1\\\" and my solution kind of ignores that change.

(Also, unrelated and not that important, I noticed that the comment above the last "Show all" command is wrong.)
Hello, :alien:

After some testing, I couldn't find any issue so far with your solution for double spaces in the file name, so I have updated the tutorial to now include this so others won't have the same issue anymore.

Thank you.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro for Workstations
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom self build
    CPU
    Intel i7-8700K 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz (F4-3600C18D-32GTZR)
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING (11GB GDDR5X)
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    2 x Samsung Odyssey G75 27"
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Samsung 990 PRO M.2,
    4TB Samsung 990 PRO M.2,
    8TB WD MyCloudEX2Ultra NAS
    PSU
    Seasonic Prime Titanium 850W
    Case
    Thermaltake Core P3 wall mounted
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master 3
    Internet Speed
    1 Gbps Download and 35 Mbps Upload
    Browser
    Google Chrome
    Antivirus
    Microsoft Defender and Malwarebytes Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Galaxy S23 Plus phone
  • Operating System
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Surface Laptop 7 Copilot+ PC
    CPU
    Snapdragon X Elite (12 core) 3.42 GHz
    Memory
    16 GB LPDDR5x-7467 MHz
    Monitor(s) Displays
    15" HDR
    Screen Resolution
    2496 x 1664
    Hard Drives
    1 TB SSD
    Internet Speed
    Wi-Fi 7 and Bluetooth 5.4
    Browser
    Chrome and Edge
    Antivirus
    Windows Defender
As it turns out my solution above introduces a new error when a filename includes a single quotation mark (').
So maybe it was better as it was before since double spaces are probably less frequent than single quotation marks.
I haven't found a way to make it work in both cases.
 

My Computer

System One

  • OS
    Windows 11 Pro
As it turns out my solution above introduces a new error when a filename includes a single quotation mark (').
So maybe it was better as it was before since double spaces are probably less frequent than single quotation marks.
I haven't found a way to make it work in both cases.
That's ok. Both are not often used, so we'll see and adjust accordingly. :shawn:
 

My Computers

System One System Two

  • OS
    Windows 11 Pro for Workstations
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom self build
    CPU
    Intel i7-8700K 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz (F4-3600C18D-32GTZR)
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING (11GB GDDR5X)
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    2 x Samsung Odyssey G75 27"
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Samsung 990 PRO M.2,
    4TB Samsung 990 PRO M.2,
    8TB WD MyCloudEX2Ultra NAS
    PSU
    Seasonic Prime Titanium 850W
    Case
    Thermaltake Core P3 wall mounted
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master 3
    Internet Speed
    1 Gbps Download and 35 Mbps Upload
    Browser
    Google Chrome
    Antivirus
    Microsoft Defender and Malwarebytes Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Galaxy S23 Plus phone
  • Operating System
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Surface Laptop 7 Copilot+ PC
    CPU
    Snapdragon X Elite (12 core) 3.42 GHz
    Memory
    16 GB LPDDR5x-7467 MHz
    Monitor(s) Displays
    15" HDR
    Screen Resolution
    2496 x 1664
    Hard Drives
    1 TB SSD
    Internet Speed
    Wi-Fi 7 and Bluetooth 5.4
    Browser
    Chrome and Edge
    Antivirus
    Windows Defender

My Computers

System One System Two

  • OS
    Windows 11 Pro for Workstations
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom self build
    CPU
    Intel i7-8700K 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz (F4-3600C18D-32GTZR)
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING (11GB GDDR5X)
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    2 x Samsung Odyssey G75 27"
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Samsung 990 PRO M.2,
    4TB Samsung 990 PRO M.2,
    8TB WD MyCloudEX2Ultra NAS
    PSU
    Seasonic Prime Titanium 850W
    Case
    Thermaltake Core P3 wall mounted
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master 3
    Internet Speed
    1 Gbps Download and 35 Mbps Upload
    Browser
    Google Chrome
    Antivirus
    Microsoft Defender and Malwarebytes Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Galaxy S23 Plus phone
  • Operating System
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Surface Laptop 7 Copilot+ PC
    CPU
    Snapdragon X Elite (12 core) 3.42 GHz
    Memory
    16 GB LPDDR5x-7467 MHz
    Monitor(s) Displays
    15" HDR
    Screen Resolution
    2496 x 1664
    Hard Drives
    1 TB SSD
    Internet Speed
    Wi-Fi 7 and Bluetooth 5.4
    Browser
    Chrome and Edge
    Antivirus
    Windows Defender
@Brink
Don't try passing %1 directly on PS's command line.
You'll go insane trying to escape every possible special character.

Instead, I solved this puzzle by using "cmd /c echo %1" to pass the entire pathname into PS's standard input.

From there, we don't need any magic except to [string] cast the input line, and truncate the \" constructs wrapped on both ends.
Code:
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash $file.substring(2,$file.length - 5) -algorithm MD5 ^| format-list; while (1) {}"

Bonus points:
1. I moved the MD5 hash to the context menu's top, instead of being stuck in the middle. The menu should be ordered by increasing hash complexity.
2. Cleaned up the "All" menu option, so it doesn't print any wasted lines.

Single quotes and double spaces are welcomed. 🔥

MD5
Code:
Algorithm : MD5
Hash      : B0A921090EF3CD59017958D9AEE39BAB
Path      : C:\Users\GARLIN\Downloads\Why does this filename have a '  &  ` and two  spaces.txt

All
Code:
Path:
C:\Users\GARLIN\Downloads\Why does this filename have a '  &  ` and two  spaces.txt

MD5:
B0A921090EF3CD59017958D9AEE39BAB

SHA1:
330E2135E6F0864121FF2FE9564007AA2637341D

SHA256:
AA6CEFD101688301B17CD215B06479B1A7E0B3E29E724AD8E29B7C2FD0CB5210

SHA384:
FA30C6739FB692A24F19F69D7D3220AE06596CBA4EBDDC2A25F5DB01C6811907A996B256380DD2A727E0BD1191FD9BD9

SHA512:
14CAC1812F6D58B92C980222AD50139AD713FF2F3A5837CFD4FCB33EA055B6FE410CEEC77F9C6E7A64D6525FC02152E9BAF8A37E9E592404612A9D0861780476

MACTRIPLEDES:
40755009D9A85B81

RIPEMD160:
821EF33CC01FA53E76A2F78928489DEA2E92C0FD
 

Attachments

My Computer

System One

  • OS
    Windows 7
@Brink
Don't try passing %1 directly on PS's command line.
You'll go insane trying to escape every possible special character.

Instead, I solved this puzzle by using "cmd /c echo %1" to pass the entire pathname into PS's standard input.

From there, we don't need any magic except to [string] cast the input line, and truncate the \" constructs wrapped on both ends.

Thank you garlin. That's much better. Tutorial updated for this. :shawn:
 

My Computers

System One System Two

  • OS
    Windows 11 Pro for Workstations
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom self build
    CPU
    Intel i7-8700K 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz (F4-3600C18D-32GTZR)
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING (11GB GDDR5X)
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    2 x Samsung Odyssey G75 27"
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Samsung 990 PRO M.2,
    4TB Samsung 990 PRO M.2,
    8TB WD MyCloudEX2Ultra NAS
    PSU
    Seasonic Prime Titanium 850W
    Case
    Thermaltake Core P3 wall mounted
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master 3
    Internet Speed
    1 Gbps Download and 35 Mbps Upload
    Browser
    Google Chrome
    Antivirus
    Microsoft Defender and Malwarebytes Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Galaxy S23 Plus phone
  • Operating System
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Surface Laptop 7 Copilot+ PC
    CPU
    Snapdragon X Elite (12 core) 3.42 GHz
    Memory
    16 GB LPDDR5x-7467 MHz
    Monitor(s) Displays
    15" HDR
    Screen Resolution
    2496 x 1664
    Hard Drives
    1 TB SSD
    Internet Speed
    Wi-Fi 7 and Bluetooth 5.4
    Browser
    Chrome and Edge
    Antivirus
    Windows Defender
Thank you @garlin for your solution.
While trying (and failing) to solve this, I found an entirely different way to do it, so I'll add it here just in case.

The command for MD5 for example would be:
@="cmd.exe /k CertUtil -hashfile \"%1\" MD5 | find /v \"CertUtil\""

CertUtil supports the following hash algorithms: MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512
 

My Computer

System One

  • OS
    Windows 11 Pro
Surely there's a better way to keep the window open then a dangling infinite loop which runs a core at 100% CPU usage. ISTR the old version left you at a command prompt.

ETA: Replacing the "while (1) {}" with the following seems to work OK (thanks google search):

Powershell:
Write-Host 'Press any key to exit'; $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')

ETA2: It works OK as long as you copy the hash before Alt+Tabbing away. As soon as I press Alt, the window closes. Anyone have a solution for that?
 
Last edited:

My Computer

System One

  • OS
    Windows 11
Surely there's a better way to keep the window open then a dangling infinite loop which runs a core at 100% CPU usage. ISTR the old version left you at a command prompt.

ETA: Replacing the "while (1) {}" with the following seems to work OK (thanks google search):

Powershell:
Write-Host 'Press any key to exit'; $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')

ETA2: It works OK as long as you copy the hash before Alt+Tabbing away. As soon as I press Alt, the window closes. Anyone have a solution for that?
I would have edited the post again, but it appears the window for that is maybe one hour long? Anyway, here's another approach:

ETA3: Replacing the "while (1) {}" with the following leaves the window in the same state without consuming CPU, and it will close in a day if forgotten:

Powershell:
Start-Sleep -Seconds 86400

You can close the window by clicking its close button or typing Ctrl+C.
 

My Computer

System One

  • OS
    Windows 11
@Brink
Don't try passing %1 directly on PS's command line.
You'll go insane trying to escape every possible special character.

Instead, I solved this puzzle by using "cmd /c echo %1" to pass the entire pathname into PS's standard input.

From there, we don't need any magic except to [string] cast the input line, and truncate the \" constructs wrapped on both ends.
Code:
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash $file.substring(2,$file.length - 5) -algorithm MD5 ^| format-list; while (1) {}"

Bonus points:
1. I moved the MD5 hash to the context menu's top, instead of being stuck in the middle. The menu should be ordered by increasing hash complexity.
2. Cleaned up the "All" menu option, so it doesn't print any wasted lines.

Single quotes and double spaces are welcomed. 🔥

Two changes need to be made, and the second one is especially important, because the new, improved method silently misses certain filenames without it:

  1. The CPU-consuming infinite while loop at the end has got to go. I've presented a couple of alternatives (I like the one that uses Start-Sleep), but you could also do away with the final action and restore the -noexit option to the powershell command, which is what the original .reg file used. It never particularly bothered me.
  2. Restore the use of -literalpath to get-filehash so that powershell doesn't interpret square brackets as a character class, causing it to silently fail to process filenames like "x[y].txt".
 

My Computer

System One

  • OS
    Windows 11
I suggest you read up on -literalpath failing with special chars, it's not a trivial fix. Restoring -literalpath is trading one set of parsing errors for another.
 

My Computer

System One

  • OS
    Windows 7
I suggest you read up on -literalpath failing with special chars, it's not a trivial fix. Restoring -literalpath is trading one set of parsing errors for another.
Do you have a link? Google is not helping me. I've actually run into the problem with the square brackets, which caused my script to silently ignore filenames read from a text file. The -literalpath option solved that problem, and I'm not aware it's caused me any others. However, it's impossible for PowerShell to surprise me, because I expect to be surprised at every turn.
 

My Computer

System One

  • OS
    Windows 11
I'm going to walk back my last statement, and agree -literalpath does work for 'x[y].txt'
Code:
Path:
C:\Users\GARLIN\Downloads\A [long] walk in the park with two  spaces ` & '.txt

MD5:
C131EE4EA9B7A344A51B96E7E72D92AD

SHA1:
E11F9A111EF2F5254BC261AB95962A28C32A8E4E

SHA256:
3CD69DBADFA920EA22FCA9C199DAADC7E07C7577A4025A09B281C6B2A9E4222A

SHA384:
672EB6CBB6D3FEFA399464413E78BA4B3D7313259A5E71ADBD960994B0715F43F71D356F8B389BA82A65507D207C983C

SHA512:
1C804B0EB7421374240B4CA8A117E4FA7068B4241D698E407EE6F84E01271E58ACFDD98FBA68B119B1E69F33971EB0C5EBE668837C054B073A0DA499308FB6A4

MACTRIPLEDES:
FFD0A23B2501DCA5

RIPEMD160:
B1EC834051242D96DF8DCA56F004CBA50BDE2350

Switched the "while (1)" to "Start-Sleep 3600", or leaving the window open for one hour.
 

Attachments

My Computer

System One

  • OS
    Windows 7
Thank you again @garlin. REG file now updated in tutorial. :shawn:
 

My Computers

System One System Two

  • OS
    Windows 11 Pro for Workstations
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom self build
    CPU
    Intel i7-8700K 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz (F4-3600C18D-32GTZR)
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING (11GB GDDR5X)
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    2 x Samsung Odyssey G75 27"
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Samsung 990 PRO M.2,
    4TB Samsung 990 PRO M.2,
    8TB WD MyCloudEX2Ultra NAS
    PSU
    Seasonic Prime Titanium 850W
    Case
    Thermaltake Core P3 wall mounted
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master 3
    Internet Speed
    1 Gbps Download and 35 Mbps Upload
    Browser
    Google Chrome
    Antivirus
    Microsoft Defender and Malwarebytes Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Galaxy S23 Plus phone
  • Operating System
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Surface Laptop 7 Copilot+ PC
    CPU
    Snapdragon X Elite (12 core) 3.42 GHz
    Memory
    16 GB LPDDR5x-7467 MHz
    Monitor(s) Displays
    15" HDR
    Screen Resolution
    2496 x 1664
    Hard Drives
    1 TB SSD
    Internet Speed
    Wi-Fi 7 and Bluetooth 5.4
    Browser
    Chrome and Edge
    Antivirus
    Windows Defender

Latest Support Threads

Back
Top