Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows batch script to unhide files hidden by virus

Since I'm seing many people having their files hidden by flash drive viruses, I'm giving them a Windows command line using attrib (or using Linux) to solve the problem when the infected files are removed and the their files are still "missing". The command removing file and folders properties system, hidden and arquive (not really needed):

attrib -s -h -a /s /d <drive letter>:\*.*

Does anyone know a how to make a script to prompt the user for the drive letter or folder? I've already seen some software that does something like this but I think this would be better.

thx!

[Solved] Solved using Cheeso's code as base

@ECHO OFF
ECHO "Enter Drive letter"
set /p letter=

attrib -s -h -a /s /d %letter%:*.*

[Improved a bit]

@ECHO OFF
ECHO Type the drive letter. ONLY the letter.
ECHO ALL FILES ARE GOING TO BE MODIFIED!!!
set /p letter=

ECHO %letter%: selected
taskkill /im explorer.exe /f
ECHO.
ECHO "Modifying files..."
ECHO.

attrib -s -h -a /s /d %letter%:\*.*

ECHO "Process completed."

start explorer %letter%:
taskkill /im cmd.exe /f
like image 364
msmafra Avatar asked Nov 11 '11 13:11

msmafra


People also ask

How do I unhide files and folders hidden by virus?

Navigate to my documents, organize, folder and search options and click the view tab. Under the Hidden files and folders, select the show hidden files, folders and drives. Uncheck the "hide extensions for known files" and "hide protected operating system files".

How do I make hidden files visible in CMD?

Way 1: view hidden files with dir command 1. Hit Windows Key + X on your keyboard, and select Command Prompt (Admin) from the menu. 2. Type dir F: /a:h /b /s and press Enter to show hidden files in drive F.


2 Answers

echo "Enter Drive letter" 
set /p driveletter=

attrib -s -h -a /s /d  %driveletter%:\*.*
like image 157
Cheeso Avatar answered Sep 27 '22 22:09

Cheeso


Try this.

Does not require any options to change.

Does not require any command line activity.

Just run software and you will done the job.

www.vhghorecha.in/unhide-all-files-folders-virus/

Happy Knowledge Sharing

like image 22
Vimal Ghorecha Avatar answered Sep 27 '22 21:09

Vimal Ghorecha