Skip to content

Instantly share code, notes, and snippets.

@0verflowme
Forked from egre55/find_writable_locations.bat
Created November 26, 2019 05:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0verflowme/94c17b32a424c1cedbc5b76d15e739b2 to your computer and use it in GitHub Desktop.
Save 0verflowme/94c17b32a424c1cedbc5b76d15e739b2 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