Skip to content

Instantly share code, notes, and snippets.

View benevides's full-sized avatar

Nelson Benevides benevides

View GitHub Profile
@benevides
benevides / .Files.bat
Created September 30, 2021 13:34 — forked from AveYo/.Files.bat
Files.html listing from directory context-menu ( or simpler, but less fancy Files.xml )
;@echo off &title Files.html listing from directory context-menu by AveYo v1.0
;if not exist "%~1" ( goto :setup ) else pushd "%~1\.." &echo Listing "%~1" - please wait... &set "fn=%~nx1 Files.html"
;del /f/q "%fn%" >nul 2>nul &cd.>"%fn%" 2>nul
;if exist "%fn%" ( set "files=%CD%\%fn%" ) else set "files=%USERPROFILE%\Desktop\%fn%"
;pushd "%~1"
;set "ampersand=&" &set "escape=&"
;> "%files%" findstr -bv ; "%~f0"
;>>"%files%" echo ^<p^>%DATE%, %TIME%^</p^>^<div class="filetree"^>
;>>"%files%" <nul set/p="<ul class="main-tree"><li class="tree-title">%~1</li>"
;>>"%files%" echo.
@benevides
benevides / .FreeStandbyMemory.bat
Created September 30, 2021 13:34 — forked from AveYo/.FreeStandbyMemory.bat
FreeStandbyMemory.bat - ninja edits at https://pastebin.com/Kj36ug5h
/* 2>nul || title FreeStandbyMemory.bat by AveYo v2019.06.01
@echo off|| csc compiling snippet, advanced schedule, builtin add_remove - UPDATE: reliable free memory detection
set/a CLEAR_EVERY_MINUTES=1
set/a CLEAR_WHEN_UNDER_MB=512
set/a CLEAR_SYSTEMCACHEWS=0
:: check_admin_rights
reg query "HKEY_USERS\S-1-5-20\Environment" /v TEMP >nul 2>nul || (
color 0e & echo. & echo PERMISSION DENIED! Right-click %~nx0 ^& Run as administrator
@benevides
benevides / win10colors.cmd
Created September 30, 2021 13:34 — forked from AveYo/win10colors.cmd
ANSI Colors in standard Windows 10 shell
@echo off
title Windows 10 native ANSI colors fast and compact macro setup by AveYo - just replace ECHO with %%@%% and ^<ESC^> with @
:: Initiate macro just once
call :@echo
:: [screenonly] [processed escape sequences]
%@% @^^[101;93m @[101;93m STYLES
%@% @^^[0m @[0m Reset
%@% @^^[1m @[1m Bold
%@% @^^[4m @[4m Underline
@benevides
benevides / ..runasTI.bat
Created September 30, 2021 13:33 — forked from AveYo/..runasTI.bat
Lean and Mean runas TrustedInstaller / System compact snippet to easily integrate in your batch scripts
@(set `" <#=")& echo off& title RunAsTI - lean and mean snippet by AveYo, 2018-2021
:: can use custom args: cmdline with %* [opens "C:\" if empty]; folder/program/oneliners like: cmd /c "whoami & timeout 7"
call :RunAsTI %*
:: add Send to - RunAsTI right-click menu entry to launch files and folders as TI via explorer [optional]
set "0=%~f0"& powershell -nop -c iex(([io.file]::ReadAllText($env:0)-split':SendTo\:.*')[1])& goto :SendTo:
$SendTo=[Environment]::GetFolderPath('ApplicationData')+'\Microsoft\Windows\SendTo\RunAsTI.bat'; $enc=[Text.Encoding]::UTF8
if ($env:0 -and !(test-path -lit $SendTo)) {[IO.File]::WriteAllLines($SendTo, [io.file]::ReadAllLines($env:0,$enc))}
:SendTo:
@benevides
benevides / .. MediaCreationTool.bat ..md
Created September 30, 2021 13:33 — forked from AveYo/.. MediaCreationTool.bat ..md
Universal MediaCreationTool wrapper for all MCT Windows 10 versions from 1507 to 21H1 with business (Enterprise) edition support

Not just an Universal MediaCreationTool wrapper script with ingenious support for business editions,
Preview
A powerful yet simple windows 1X deployment automation tool as well!

awesome gui dialogs to pick windows version and preset action
Auto Setup choice for upgrade directly without prompts, with edition change / intelligent fallback
Create ISO choice for authoring iso file directly via DIR2ISO snippet, including any 'oem' customizations
Create USB choice for authoring usb via native MCT, including any 'oem' customizations (prompts once)
Select in MCT choice for vanilla MCT processing without 'oem' modifications, script quits straightway
control via set script vars, commandline parameters or rename script like iso 21H2 Pro MediaCreationTool.bat