flat assembler
Message board for the users of flat assembler.

Index > Windows > scanexe -Analyze types of EXE files in a directory in one go

Author
Thread Post new topic Reply to topic
Mаt Quasar



Joined: 29 Jun 2025
Posts: 52
Mаt Quasar 09 Dec 2025, 07:51
Derived from pebasic.asm, this scanexe.asm is exclusively designed for batch processing of all EXE files in the same directory - it analyzes every EXE file for bitness and image subsystem, as shown in screenshot or below:

Quote:

C:\Windows>\users\bookh\downloads\scanexe
bfsvc.exe is a 64-bit Console app.
explorer.exe is a 64-bit GUI app.
HelpPane.exe is a 64-bit GUI app.
hh.exe e.exe is a 64-bit GUI app.
notepad.exe is a 64-bit GUI app.
regedit.exe is a 32-bit GUI app.
splwow64.exe is a 64-bit GUI app.
winhlp32.exe is a 32-bit GUI app.
write.exe xe is a 64-bit GUI app.


Basically you put scanexe.exe in a fixed directory (preferably included in PATH environment variable), then go to the directory you want to scan for all EXEs (maximum 8192 files), and just type scanexe.exe.

Not thoroughly tested, bug report is welcome.

--------------

With a batch script (generated by AI tool), you can loop through every EXE on C drive, such as:

Code:
@echo off
setlocal

set "root_dir=C:\"

pushd "%root_dir%"

for /d /r  %%i in (*) do (
    echo Processing directory: "%%i"
    cd %%i
    scanexe.exe
    pause
)

popd
endlocal    
    


(Provided scanexe.exe is in environment variable "PATH")

You can also redirect output to text file using ">" or ">>".

Extra: The following code creates a full report on every EXE on your C drive as REPORTS.TXT

(You may need to run CMD.EXE as Administrator so the scanexe.exe can process system folders)

Code:
@echo off
setlocal

set "root_dir=C:\"

pushd "%root_dir%"

for /d /r  %%i in (*) do (
    echo Processing directory: "%%i"
    cd %%i
    echo %%i >> %root_dir%reports.txt
    scanexe.exe >> %root_dir%reports.txt
)

popd
endlocal    
    

--------------

After running the script above for more than 2 hours, it still hasn't finished scanning all files in my C drive.

Using an advanced text editor like Notepad++, can examining the C:\REPORTS.TXT by searching for "32-bit" / "64-bit" / "Console app" / "GUI app".

Below are number of occurrences:

32-bit EXE - 1032
64-bit EXE - 1457
--
Console app - 1456
GUI app - 1033
--
32-bit Console app - 483
64-bit Console app - 973
32-bit GUI app - 549
64-bit GUI app - 484

The generated text file is too large to be attached here (5MB ++), but forget about ZIP file, no point uploading here.


Description: Screenshot showing "scanexe.exe" in action!
Filesize: 31.08 KB
Viewed: 170 Time(s)

scanexe.PNG


Description: License: CC0
Download
Filename: scanexe.ASM
Filesize: 5.1 KB
Downloaded: 17 Time(s)



Last edited by Mаt Quasar on 10 Dec 2025, 11:04; edited 7 times in total
Post 09 Dec 2025, 07:51
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.