Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Echo off
- CD /D "%~dp0"
- Setlocal EnableExtensions DisableDelayedExpansion
- REM this script removes the Zone.Identifier Aletrnate Data Stream from all .bat
- REM files in this directory and it's subdirectories
- REM An ADS is automatically embedded by windows when a file is downloaded.
- REM .bat with a ZoneIdentifier that flags as non-local will trigger the UAC prompt when run
- REM Positive affirmation of intent
- Echo( Confirm Y / N
- Echo( Do you want to remove The ZoneIdentifier Stream from all .bat file in "%~dp0"
- For /f "Delims=" %%K in ('Choice /N /C:YN') Do Call:%%K
- Pause
- exit /b 0
- :Y
- For /f "delims=" %%G in ('%systemroot%\system32\where.exe PowerShell.exe')Do if not defined powershell Set powershell="%%~G"
- Set /a removed=ignored=0,last=1
- For /f "Delims=" %%G in ('dir /b /s /a:-D *.bat') Do (
- 1> nul 2> nul %powershell% -c "remove-item -path '%%~fG' -Stream 'Zone.Identifier'
- If not errorlevel 1 (
- 2> nul Set /a "1/last" || Echo(
- Echo Removed stream from: "%%~fG"
- Set /a removed += 1, last=1
- ) else (
- <nul set /p "=."
- Set /a ignored += 1, last=0
- )
- (Call )
- )
- Echo(
- Echo( Streams removed:%removed% ignored:%ignored%
- Exit /b 0
- :N
- Echo No action taken
- Exit /b 0
Advertisement
Add Comment
Please, Sign In to add comment