Created
October 11, 2018 11:47
-
-
Save egre55/7a78d9ac455203f331bde1c20d6bc497 to your computer and use it in GitHub Desktop.
find_writable_locations.bat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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