/build/static/layout/Breadcrumb_cap_w.png

Search for EXE files in a specific folder

Hi,

Our antivirus is not perfect and I am trying to create a script that would detect executables files in the following folders:

C:\Documents and Settings\All Users

C:\Documents and Settings\%user%

I have managed to detect a specific file in a specific folder, but I can't figure out to make a search on *.exe files

Thanks in advance for your help


3 Comments   [ + ] Show comments
  • this maybe?

    @ECHO OFF

    :: [- look & delete in specified folders -]

    Pushd "%userprofile%\"
    for %%f in (*.exe) do del %%f /f

    Exit /B - mattski 10 years ago
  • Don't run that script if you want to KEEP the exe files - I read it as the OP wants to DETECT, not delete the .exe files. - dunnpy 10 years ago
  • sorry, my bad! Use this powershell script I wrote:

    For Win7:

    Get-ChildItem -filter "*.exe" -Recurse c:\Users\* | Out-File -FilePath c:\list.txt

    For XP:

    Get-ChildItem -filter "*.exe" -Recurse c:\Documents and Settings\* | Out-File -FilePath c:\list.txt - mattski 10 years ago

Answers (2)

Posted by: SMal.tmcc 10 years ago
Red Belt
1

you can use wmic calls to search this out

wmic process where "name like '%.exe'" get name   will return all running exe's

WMIC.exe PROCESS where (executablepath like "%%AppDat%%") get executablepath will show all running exe's in a user appdata structure

also see for vb script to search for exe

http://www.pctools.com/forum/archive/index.php/t-19886.html

Posted by: drose23 10 years ago
Second Degree Blue Belt
0

Apologies for posting so far after the fact, getting caught up on some threads. 

May not be what you are looking for exactly, but I did something similar recently where I was trying to find *.wav files on systems.  As you'd imagine, I also wanted to exclude certain directories because this is a common file type, much like .exe files.  After a decent amount of research, I found robocopy to be my best solution.

On Windows 7 x64 systems, I'd run this script:

IF NOT EXIST \\%SERVER%\Inventory\WAV_FILES\%computername% MD \\%SERVER%\Inventory\WAV_FILES\%computername%
Robocopy.exe C:\ %TEMP% *.wav /S /XD Windows "Program Files" "Program Files (x86)" /XJ /L /NC /NDL /NP /NJH /NJS >\\%SERVER%\Inventory\WAV_FILES\%computername%\%computername%_wav.txt

The above script will verify a folder exists on a defined path, create if not - perform a search for all *.wav files, using the /XD to exclude certain paths.  Results will be written to a text file in the referenced location.  Modify accordingly for x86 or Windows XP.

HTH

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ