Last active
October 7, 2025 01:03
-
-
Save curability4apish/96c2f1bb45426afac7cf2761ff73b9f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| setlocal enabledelayedexpansion | |
| rem Manually define the Downloads folder path here | |
| set "downloadsFolder=D:\Downloads" | |
| rem Check if the path is valid | |
| if not exist "!downloadsFolder!" ( | |
| echo Error: The specified folder does not exist. | |
| goto :end | |
| ) | |
| :main | |
| cls | |
| echo Listing all .exe and .zip files in the specified Downloads folder (newest to oldest): | |
| set "count=0" | |
| for /f "tokens=*" %%F in ('dir "!downloadsFolder!\*.exe" "!downloadsFolder!\*.zip" /b /a-d /o-d /t:c 2^>nul') do ( | |
| set /a count+=1 | |
| echo !count!. %%F | |
| set "file[!count!]=%%F" | |
| ) | |
| rem Check if any .exe or .zip files were found | |
| if %count%==0 ( | |
| echo No .exe or .zip files found in the Downloads folder. | |
| goto :list_other_files | |
| ) | |
| rem Prompt user to select a file | |
| echo. | |
| echo Press 0 to list other files (e.g., .docx, .mp4) in the Downloads folder. | |
| set /p "choice=Enter the number of the file you want to select: " | |
| if %choice%==0 ( | |
| goto :list_other_files | |
| ) | |
| set "selectedFile=!file[%choice%]!" | |
| rem Validate the user's choice | |
| if "!selectedFile!"=="" ( | |
| echo Invalid selection. | |
| goto :main | |
| ) | |
| goto :process_file | |
| :list_other_files | |
| cls | |
| echo Listing other files in the specified Downloads folder (newest to oldest): | |
| set "count=0" | |
| for /f "tokens=*" %%F in ('dir "!downloadsFolder!\*" /b /a-d /o-d /t:c 2^>nul ^| findstr /v /i /e ".exe .zip"') do ( | |
| set /a count+=1 | |
| echo !count!. %%F | |
| set "file[!count!]=%%F" | |
| ) | |
| rem Check if any other files were found | |
| if %count%==0 ( | |
| echo No other files found in the Downloads folder. | |
| goto :main | |
| ) | |
| rem Prompt user to select a file from the additional list | |
| echo. | |
| echo Press 0 to go back to the previous menu. | |
| set /p "choice=Enter the number of the file you want to select: " | |
| if %choice%==0 ( | |
| goto :main | |
| ) | |
| set "selectedFile=!file[%choice%]!" | |
| rem Validate the user's choice | |
| if "!selectedFile!"=="" ( | |
| echo Invalid selection. | |
| goto :list_other_files | |
| ) | |
| goto :process_file | |
| :process_file | |
| set "filePath=!downloadsFolder!\!selectedFile!" | |
| echo Selected File Path: !filePath! | |
| rem Check if the file exists | |
| if not exist "!filePath!" ( | |
| echo Error: The selected file does not exist. | |
| goto :main | |
| ) | |
| rem Calculate the MD5 hash and output to temp.txt | |
| certUtil -hashfile "!filePath!" MD5 > temp.txt | |
| rem Read the output and find the line that contains the actual hash | |
| set "hash=" | |
| for /f "skip=1 tokens=*" %%A in (temp.txt) do ( | |
| if not defined hash ( | |
| set "hash=%%A" | |
| ) | |
| ) | |
| rem Remove trailing spaces from the hash | |
| for %%A in (!hash!) do set "hash=%%A" | |
| rem Check if hash is set | |
| if not defined hash ( | |
| echo Error: Could not calculate the hash. | |
| goto :main | |
| ) | |
| echo Hash: !hash! | |
| rem Open the URL in the default web browser | |
| start https://www.virustotal.com/gui/file/!hash! | |
| del temp.txt | |
| goto :main | |
| :end | |
| pause |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
VirusTotal Opener
Description
This batch script opens VirusTotal's webpage of the scan result of the file you want to scan. If it hasn't been uploaded, you may upload it manually through your browser.
How It Works
The script initially lists all
.exeand.zipfiles in the user's Downloads folder.The user is prompted to select a file from the list by entering the corresponding number.
If the user enters
0, the script lists other types of files in the Downloads folder.The user can then select a file from the new list or go back to the previous menu by entering
0.Once a file is selected, the script calculates its MD5 hash.
The script opens a VirusTotal URL with the calculated hash for scanning.
The script loops back to the main menu after processing the file.
Prerequisites
certUtilutility (included with Windows) to calculate the MD5 hash.v2 Updates