Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have added, via the registry, a right click menu option for all filetypes which is supposed to get the MD5 checksum for a file.

HKEY_CLASSES_ROOT*\shell\Checksum - Default: Get Checksum

and

HKEY_CLASSES_ROOT*\shell\Checksum\command - Default: checksum.cmd "%1"

checksum.cmd simply clears the screen, calls fciv.exe using %1 and then pauses.

Unfortunately, whilst the option "Get Checksum" appears correctly in the right click menu, it doesn't perform the right action when clicked. When I click it an "Open With" dialog opens, which is of course not what I want.

Both checksum.cmd and fciv.exe are in the PATH.

checksum.cmd:

@echo off
cls
fciv.exe %1
pause

Anybody know what's going on?

share|improve this question
    
can you show us the checksum.cmd content? do you pass %1 parameter correctly to fciv.exe ? –  mnmnc Aug 31 '12 at 9:56
1  
You may have to make the Checksum\command something like default: cmd.exe /C checksum.cmd "%1". –  martineau Aug 31 '12 at 9:59
    
I've edited my OP to include checksum.cmd contents. –  Luke Aug 31 '12 at 10:02
    
Thanks Martineau, I'll try that. EDIT: It worked! Thanks. If you post that as an answer I will accept it. –  Luke Aug 31 '12 at 10:03
1  
@martineau Post your answer. -Luke you need to use @ sign to call someone i think. Otherwise he might no know you are talking to him. –  mnmnc Aug 31 '12 at 12:18

1 Answer 1

up vote 1 down vote accepted

In order to execute the .cmd file you need to invoke the Windows command shell and tell it to interpret the script. To set this up in the registry, change the data for the (Default) value of the command key to cmd.exe as shown:

HKEY_CLASSES_ROOT\*\shell\Checksum\command - Default: cmd.exe /C checsum.cmd "%1"

BTW, you could replace the pause command in your script with something that would automatically wait for a specified amount of time -- long enough for you to read the output -- before continuing on and doing other things or allowing the window to disappear. For example to pause for 5 seconds, you could use:

ping 1.0.0.0 -n 1 -w 5000 >nul

The value following the -w argument gives the amount of time in milliseconds to wait.

share|improve this answer
    
Thanks very much! –  Luke Sep 4 '12 at 13:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.