Skip to content

Instantly share code, notes, and snippets.

@AveYo
AveYo / ..runasTI.bat
Last active Aug 2, 2021
Lean and Mean runas TrustedInstaller / System compact snippet to easily integrate in your batch scripts
View ..runasTI.bat
@(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:
@AveYo
AveYo / win10colors.cmd
Last active Dec 1, 2020 — forked from mlocati/win10colors.cmd
ANSI Colors in standard Windows 10 shell
View win10colors.cmd
@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
@AveYo
AveYo / .. MediaCreationTool.bat ..md
Last active Sep 22, 2021
Universal MediaCreationTool wrapper for all MCT Windows 10 versions from 1507 to 21H1 with business (Enterprise) edition support
View .. MediaCreationTool.bat ..md

use download ZIP button or pastebin link to get the script, as saving the Raw file breaks line endings

Preview

Create ISO directly now available if ISO var set / script renamed with iso / provided via commandline
via built-in powershell snippet

Dialogs to pick version, then to pick Auto Setup, Create ISO or Select in MCT
now more readable by using inverted selection style, and streamlined in a single powershell instance

@AveYo
AveYo / .FreeStandbyMemory.bat
Last active Aug 14, 2021
FreeStandbyMemory.bat - ninja edits at https://pastebin.com/Kj36ug5h
View .FreeStandbyMemory.bat
/* 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
View products_2018_10_02.xml
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?>=
<PublishedMedia id="2072" release="20181002 RS5 RTM WU">
<Files>
<File id="470474">
<FileName>17763.1.180914-1434.rs5_release_CLIENTCHINA_RET_x64FRE_zh-cn.esd</FileName>
<LanguageCode>zh-cn</LanguageCode>
<Language>Chinese Simplified</Language>
<Edition>CoreCountrySpecific</Edition>
<Architecture>x64</Architecture>
@AveYo
AveYo / .Close_Handles_ContextMenu.bat
Last active Aug 27, 2021
'Close Handles' context menu to unlock files or folders - https://www.youtube.com/watch?v=BEcDwKTyAYY
View .Close_Handles_ContextMenu.bat
@echo off &Title 'Close Handles' context menu to unlock files or folders by AveYo v2019.09.27
:: changelog: fix dl; add /accepteula; check S-1-5-19 for admin; ask for admin rights to catch system handles; auto-hide window
:: add_remove whenever script is run again
reg query "HKCU\Software\Classes\Directory\shell\CloseHandles" /v MuiVerb >nul 2>nul && (
reg delete HKCU\Software\Classes\Directory\shell\CloseHandles /f >nul 2>nul
reg delete HKCU\Software\Classes\Drive\shell\CloseHandles /f >nul 2>nul
reg delete HKCU\Software\Classes\*\shell\CloseHandles /f >nul 2>nul
color 0c &echo. &echo REMOVED! Run script again to add 'Close Handles' context menu
timeout /t -1 &color 0f &title %COMSPEC% &exit/b
@AveYo
AveYo / .Files.bat
Last active Feb 15, 2021
Files.html listing from directory context-menu ( or simpler, but less fancy Files.xml )
View .Files.bat
;@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=&amp;"
;> "%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.
@AveYo
AveYo / !WebSearchChoice.bat
Last active Aug 14, 2021
Web Search Choice for Cortana - direct input to console fixed!
View !WebSearchChoice.bat
@echo off &title WebSearchChoice
set "browser=iexplore.exe"
set "url=google.com/search?q="
echo.
echo Will override Cortana search Edge browser with: %browser%
set/p "browser_choice=-Enter new choice, or press Enter to use above: "
if "%browser_choice%"=="0" goto uninstall
echo.
@AveYo
AveYo / !BlackLess.md
Last active May 24, 2021
A High Contrast based neutral / less blues tone Windows Dark / Light Theme by AveYo
@AveYo
AveYo / multiple_gui_choices.bat
Last active Aug 14, 2021
Simple GUI helpers for batch files
View multiple_gui_choices.bat
@echo off &title Multiple GUI choices via powershell snippet by AveYo &rem preview: https://i.imgur.com/JjazNR0.png
:: setup gui dialog choices
set all_choices=Option 1,Option 2,Option 3,Option4,Option5
set def_choices=Option 1,Option 2,Option5
:: Show gui dialog choices 1=title 2=all_choices 3=def_choices 4=output_variable
call :choices "Multiple GUI choices" "%all_choices%" "%def_choices%" CHOICES
:: Quit if no choice selected
if not defined CHOICES color 0c &echo ERROR! No choice selected.. &timeout /t 20 &color 07 &exit/b
:: Print choices
echo Choices: %CHOICES% & echo.