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
| @if defined eratosSort goto sort | |
| @echo off | |
| setlocal enabledelayedexpansion enableextensions | |
| %= Input is either first argument or stdin =% | |
| if "%~1"=="" ( | |
| set /p n=|| goto :eof | |
| set /a n=n | |
| ) else (set /a n=%~1) | |
| ( | |
| if %n% lss 2 goto help |
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 | |
| setlocal enableextensions | |
| :: curl should be available by default in Windows 10 Insider build 17063 and later | |
| :: Source: https://devblogs.microsoft.com/commandline/tar-and-curl-come-to-windows/ | |
| for /f "tokens=*" %%a in ('curl -s -L http://example.com') do ( | |
| echo(%%a | |
| set "str=%%a" | |
| ) | |
| mshta "about:%str:"=""%" |
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
| @if (@X)==(@Y) @end /* | |
| @echo off | |
| setlocal enabledelayedexpansion | |
| ::http://ss64.org/viewtopic.php?id=1344 | |
| for /F "usebackq" %%a in (`copy /Z "%~f0" nul`) do set "cr=%%a" | |
| set /a idx=0 | |
| for %%i in (/ - \ ^|) do ( | |
| set spin.!idx!=%%i | |
| set /a idx+=1 | |
| ) |
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
| @if (@X == @Y) @end /* | |
| @echo off | |
| setlocal enableextensions enabledelayedexpansion | |
| for /f %%A in ('prompt $H ^&echo on ^&for %%B in ^(1^) do rem') do set bs=%%A | |
| set ansi1= | |
| set ansi2= | |
| 2>nul >nul (reg query HKCU\Console /v VirtualTerminalLevel /t REG_DWORD | find "0x1") && ( | |
| set ansi1=[1;33m | |
| set ansi2=[0m | |
| ) |
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
| @if (@X == @Y) @end /* | |
| @echo off | |
| setlocal enableextensions enabledelayedexpansion | |
| set rargs= | |
| for /f usebackq^ tokens^=1*^ eol^= %%a in ('%*') do set rargs=%%b | |
| cscript //nologo //e:jscript "%~f0" %1 | |
| exit /b | |
| */ | |
| WScript.CreateObject("Shell.Application").ShellExecute(WScript.Arguments(0), WScript.CreateObject("WScript.Shell").Environment("Process").Item("rargs"), "", "runas"); |
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 | |
| setlocal enableextensions enabledelayedexpansion | |
| for /f "delims=" %%i in ('tzutil /g') do ( | |
| for /f "delims=:" %%j in ('tzutil /l ^| findstr /N /C:"%%i"') do ( | |
| set /a "toSkip=%%j-1" | |
| goto print | |
| ) | |
| ) | |
| for /f "delims=() tokens=2" %%i in ('^(tzutil /l ^| findstr /N $^) ^| findstr /R /C:"^%toSkip%"') do echo %%i |
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 | |
| setlocal enableextensions enabledelayedexpansion | |
| if "%~1"=="/?" goto help | |
| set args=%* | |
| set prefix= | |
| if "%~1"=="/nowait" ( | |
| ::%* strips spaces | |
| set args=!args:~7! | |
| set prefix=start "" | |
| shift |
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 | |
| setlocal enableextensions enabledelayedexpansion | |
| if defined hoststreeMain goto main | |
| if "%~1"=="/?" ( | |
| for /f %%A in ('prompt $H ^&echo on ^&for %%B in ^(1^) do rem') do set bs=%%A | |
| echo Creates a HOSTS tree view with hostnames branching out of their resolving IPs. | |
| echo: | |
| echo HOSTSTREE file | |
| echo: | |
| echo !bs! file Defaults to %%SystemRoot%%\System32\drivers\etc\hosts |
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 | |
| :: detect wrapping | |
| :: writePublic defined = jump to :writePublic | |
| :: this evades CTRL-C canceling all operations | |
| :: https://stackoverflow.com/a/27131024 | |
| if "%~1"=="" if defined writePublic (goto writePublic) else (goto noargs) | |
| set writePublic= | |
| setlocal enableextensions enabledelayedexpansion | |
| if "%~1"=="/?" goto help |
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 | |
| setlocal enableextensions enabledelayedexpansion | |
| for /f "usebackq eol= delims=" %%a in ('%*') do set sArgs=%%~a | |
| ::Split at last backslash ("\") | |
| for /f "delims==" %%a in ('set _a 2^>nul') do set "%%a=" | |
| (set lf=^ | |
| ) | |
| for %%l in ("!lf!") do set "_a=!sArgs:\=%%~l!" |
NewerOlder