Skip to content

Instantly share code, notes, and snippets.

@nani1337
Forked from egre55/find_writable_locations.bat
Created December 21, 2022 00:35
Show Gist options
  • Save nani1337/6b61bcdb2549f4bb7ede158d8206094e to your computer and use it in GitHub Desktop.
Save nani1337/6b61bcdb2549f4bb7ede158d8206094e to your computer and use it in GitHub Desktop.
find_writable_locations.bat
@echo off
REM Script to find writable locations under C:\
C:
cd C:\TEMP\
echo Creating list of all directories and sub-directories
dir C:\ /s /b /o:n /a:d > C:\Temp\dirs.txt
echo Attempting to copy puttygen.exe to all folders
for /F "tokens=*" %%A in (dirs.txt) do copy "C:\Temp\puttygen.exe" "%%A" /Y
echo Attempting to execute puttygen.exe (find writable locations)
for /F "tokens=*" %%A in (dirs.txt) do if exist "%%A\puttygen.exe" echo %%A >> writable_locations.txt
echo Deleting puttygen.exe from all locations
for /F "tokens=*" %%A in (dirs.txt) do del /F "%%A\puttygen.exe"
echo Done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment