@echo off if exist %1\* ( echo Run on a file ) else ( if exist "%~1_checksum-sha512.txt" ( del "%~1_checksum-sha512.txt" ) certutil.exe -hashfile "%~1" SHA512 > "%~1_checksum-sha512.txt" start notepad "%~1_checksum-sha512.txt" )