Skip to content

Instantly share code, notes, and snippets.

@egre55
Created October 11, 2018 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save egre55/7a78d9ac455203f331bde1c20d6bc497 to your computer and use it in GitHub Desktop.
Save egre55/7a78d9ac455203f331bde1c20d6bc497 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