├── startup ├── open-startup-folder.bat └── choco-upgrade.bat ├── NTP servers.txt ├── Backup and Restore ├── Transferring Files │ ├── checksum │ │ └── corz │ │ │ └── checksum online.url │ ├── Robocopy │ │ ├── run-as.bat │ │ ├── BB-exclusions.txt │ │ ├── robocopy-files.bat │ │ └── Parsing ROBOCOPY logs.txt │ ├── RichCopy │ │ └── TechNet Utility Spotlight - RichCopy.url │ └── Robocopy GUI │ │ └── TechNet Utility Spotlight - Robocopy GUI.url ├── Data-Rescue-Legacy-Systems.md └── Clone-BackupRestoreBranchOnly.bat ├── Tools ├── SPINRITE.url ├── File In Use │ ├── Find out what is using a File In Use.url │ └── find what process is holding a file open - Server Fault.url ├── VirusScan-File.bat ├── Compare1.txt ├── Compare2.txt ├── Compare1.bat ├── Compare2.bat └── Debug-TroubleshootBatchFile.bat ├── PowerShell ├── Initialize-PowerShellEnvironment.ps1 ├── modules │ └── Task Tracker │ │ ├── TaskTrackingPs.ps1 │ │ ├── Track-SentHistory_ProductionRun.bat │ │ └── Twilio-Auth_template.ps1 ├── Test-AdministratorPermissions.ps1 ├── comp1.bat └── comp2.bat ├── functions ├── Banner.cmd - SS64.com.url ├── bat vs cmd files - StackOverflow.com.url ├── bat vs cmd files.txt ├── RunAsAdministrator │ ├── ReadMe.md │ ├── BatchGotAdmin International-Fix Code.bat │ └── SS64 Run with elevated permissions (ElevateMe.vbs).bat ├── splash │ ├── clock-ascii-art.txt │ ├── tomato-ascii-art.txt │ ├── space-ascii-art.txt │ └── demon-ascii-art.txt ├── ping-wait.cmd ├── DateMath.cmd └── matrix-timer.bat ├── AutoHotKey ├── Lightworks │ ├── create-framesplit.ahk │ ├── trim-fps.ahk │ └── get-framecount.ahk ├── Open-Handle-ProcExp.ahk ├── ExtraKeys │ ├── README.md │ └── TrueNAS-webshell-copypaste.ahk ├── copynpaste-Access-table.ahk ├── Numpad-Underscore.ahk ├── Numpad-Underscore-v2.ahk ├── ImpossiblePaste.ahk ├── Format MAC address │ ├── FormatMACaddr.ahk │ └── test.ahk ├── IQ │ ├── IQ-Excel_FixPhoneNumbers.ahk │ ├── IQ-Excel_FixIMEINumbers.ahk │ └── IQ-CXT-FixQueries.ahk ├── Notepad++ │ ├── FindAndReplace-PowerShell_Index.ahk │ └── FindAndReplace-PowerShell_Index2.ahk ├── HatOfGod_edit.style.properties └── Spam Experts │ └── Browser-Test.ahk ├── Remote Access ├── WinXP-RDP-6-hotfix.url └── SysInternals │ ├── enable_remote-access-remotely.txt │ └── ReadMe.md ├── Linux ├── Backup and Restore │ ├── Schedule-Backup.sh │ ├── How to backup a full Centos Server.url │ └── 9 commands to check hard disk partitions and disk space on Linux.url ├── LogCleanup.sh └── functions-template.sh ├── List-DomainControllers.bat ├── Get-SQLDBSize.txt ├── Test-ParameterWithSpaces.bat ├── .gitattributes ├── Call-Test.bat ├── save_RTMP_streams.bat ├── .gitignore ├── Refresh-Permissions.bat ├── functions-template_param.bat ├── Wireshark ├── tcpdump.txt └── wireshark_filters.txt ├── Local Admin group membership.txt ├── Update-MyApps.bat ├── NTP-AD.txt ├── Pull-UpdatesFromGithub.bat └── Get-WiFipasswords.bat /startup/open-startup-folder.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | START shell:startup 4 | -------------------------------------------------------------------------------- /NTP servers.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kerbalnut/Batch-Tools-SysAdmin/HEAD/NTP servers.txt -------------------------------------------------------------------------------- /Backup and Restore/Transferring Files/checksum/corz/checksum online.url: -------------------------------------------------------------------------------- 1 | [InternetShortcut] 2 | URL=http://corz.org/windows/software/checksum/ 3 | -------------------------------------------------------------------------------- /Tools/SPINRITE.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,11 3 | [InternetShortcut] 4 | IDList= 5 | URL=https://www.grc.com/sr/spinrite.htm 6 | -------------------------------------------------------------------------------- /PowerShell/Initialize-PowerShellEnvironment.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kerbalnut/Batch-Tools-SysAdmin/HEAD/PowerShell/Initialize-PowerShellEnvironment.ps1 -------------------------------------------------------------------------------- /PowerShell/modules/Task Tracker/TaskTrackingPs.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kerbalnut/Batch-Tools-SysAdmin/HEAD/PowerShell/modules/Task Tracker/TaskTrackingPs.ps1 -------------------------------------------------------------------------------- /Backup and Restore/Transferring Files/Robocopy/run-as.bat: -------------------------------------------------------------------------------- 1 | runas /user:DOMAIN\Administrator /netonly "%USERPROFILE%\Documents\SpiderOak Hive\Programming\Robocopy\ss64.bat" 2 | -------------------------------------------------------------------------------- /functions/Banner.cmd - SS64.com.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,11 3 | [InternetShortcut] 4 | IDList= 5 | URL=https://ss64.com/nt/syntax-banner.html 6 | -------------------------------------------------------------------------------- /AutoHotKey/Lightworks/create-framesplit.ahk: -------------------------------------------------------------------------------- 1 | !z:: 2 | send, ,i.{Delete} ; Number of commas (frames backward) need to equal number of periods (frames forward) e.g. send, ,,i..{Delete} 3 | Return -------------------------------------------------------------------------------- /Remote Access/WinXP-RDP-6-hotfix.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,11 3 | [InternetShortcut] 4 | IDList= 5 | URL=https://www.catalog.update.microsoft.com/Search.aspx?q=KB969084 6 | -------------------------------------------------------------------------------- /Linux/Backup and Restore/Schedule-Backup.sh: -------------------------------------------------------------------------------- 1 | 2 | Then used crontab -e to set up the following, for a nightly transfer: 3 | 4 | 1 2 * * * rsync -auvzhe ssh /dir-to-be-copied/* root@:/backupdir/ 5 | 6 | -------------------------------------------------------------------------------- /Tools/File In Use/Find out what is using a File In Use.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,11 3 | [InternetShortcut] 4 | IDList= 5 | URL=https://askleo.com/how_can_i_find_out_who_is_using_a_file_in_use/ 6 | -------------------------------------------------------------------------------- /functions/bat vs cmd files - StackOverflow.com.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,11 3 | [InternetShortcut] 4 | IDList= 5 | URL=https://stackoverflow.com/questions/148968/windows-batch-files-bat-vs-cmd 6 | -------------------------------------------------------------------------------- /Linux/Backup and Restore/How to backup a full Centos Server.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,11 3 | [InternetShortcut] 4 | IDList= 5 | URL=https://serverfault.com/questions/120431/how-to-backup-a-full-centos-server 6 | -------------------------------------------------------------------------------- /Linux/Backup and Restore/9 commands to check hard disk partitions and disk space on Linux.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,11 3 | [InternetShortcut] 4 | IDList= 5 | URL=https://www.binarytides.com/linux-command-check-disk-partitions/ 6 | -------------------------------------------------------------------------------- /Backup and Restore/Transferring Files/RichCopy/TechNet Utility Spotlight - RichCopy.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,11 3 | [InternetShortcut] 4 | IDList= 5 | URL=https://technet.microsoft.com/en-us/library/2009.04.utilityspotlight.aspx 6 | -------------------------------------------------------------------------------- /Backup and Restore/Transferring Files/Robocopy GUI/TechNet Utility Spotlight - Robocopy GUI.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,11 3 | [InternetShortcut] 4 | IDList= 5 | URL=https://technet.microsoft.com/en-us/library/2006.11.utilityspotlight 6 | -------------------------------------------------------------------------------- /List-DomainControllers.bat: -------------------------------------------------------------------------------- 1 | 2 | @ECHO %~nx0 3 | @ECHO: 4 | @ECHO List Domain Controllers (DCs) in domain. 5 | @ECHO: 6 | 7 | @SET /P "_DOMAIN_NAME=Enter domain name: " 8 | 9 | nltest.exe /DCLIST:%_DOMAIN_NAME% 10 | 11 | @ECHO: 12 | @PAUSE 13 | @EXIT /B 14 | -------------------------------------------------------------------------------- /Tools/File In Use/find what process is holding a file open - Server Fault.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,11 3 | [InternetShortcut] 4 | IDList= 5 | URL=https://serverfault.com/questions/1966/how-do-you-find-what-process-is-holding-a-file-open-in-windows 6 | -------------------------------------------------------------------------------- /Remote Access/SysInternals/enable_remote-access-remotely.txt: -------------------------------------------------------------------------------- 1 | 2 | psexec \\PC-HOSTNAME tasklist 3 | 4 | psexec \\PC-HOSTNAME powershell.exe -Command "$PSVersionTable.PSVersion" 5 | 6 | :: enter or space key if it freezes up. 7 | 8 | psexec \\PC-HOSTNAME powershell.exe -Command "Enable-PSRemoting -Force" 9 | -------------------------------------------------------------------------------- /AutoHotKey/Open-Handle-ProcExp.ahk: -------------------------------------------------------------------------------- 1 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 2 | ; #Warn ; Enable warnings to assist with detecting common errors. 3 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 4 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 5 | -------------------------------------------------------------------------------- /Get-SQLDBSize.txt: -------------------------------------------------------------------------------- 1 | Thanks to: 2 | http://www.codeproject.com/Tips/469070/SQL-Server-Get-All-Databases-Size 3 | 4 | SELECT d.name, 5 | ROUND(SUM(mf.size) * 8 / 1024, 0) Size_MBs 6 | FROM sys.master_files mf 7 | INNER JOIN sys.databases d ON d.database_id = mf.database_id 8 | WHERE d.database_id > 4 -- Skip system databases 9 | GROUP BY d.name 10 | ORDER BY d.name -------------------------------------------------------------------------------- /Tools/VirusScan-File.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | SET "_INPUT_FILE=%UserProfile%\Documents\GitHub\Batch-Tools-SysAdmin\Tools\CompareTo-Parent.bat" 4 | 5 | checksum -f="%_INPUT_FILE%" 6 | 7 | 8 | 9 | 10 | 11 | set directory=. 12 | dir /s "%directory%" >"%temp%\filelist" 13 | md5 "%temp%\filelist" >> output.txt 14 | del/q "%temp%\filelist" 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /AutoHotKey/ExtraKeys/README.md: -------------------------------------------------------------------------------- 1 | # "Extra Keys" AHK (AutoHotKey) folder 2 | 3 | This folder is for *super*-simple always-on AHK scripts, used to augment limited keyboards. 4 | 5 | For example, if your keyboard doesn't have an Insert/Home/End key, and you have a specific application or use-case that requires it. These scripts are super-simple shortcuts to activate those keys, and are designed to be always-on. 6 | -------------------------------------------------------------------------------- /Test-ParameterWithSpaces.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | ECHO: 4 | ECHO Boxstarter Template ^( %~nx0 ^) & REM This script's file name and extension. https://ss64.com/nt/syntax-args.html 5 | ECHO Working directory: %~dp0 & REM The drive letter and path of this script's location. 6 | REM Bugfix: cannot use :: for comments within IF statement, instead use REM 7 | ECHO: 8 | 9 | ECHO 1: %1 10 | ECHO 2: %2 11 | ECHO 3: %3 12 | 13 | ECHO: 14 | 15 | EXIT /B 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /Backup and Restore/Transferring Files/Robocopy/BB-exclusions.txt: -------------------------------------------------------------------------------- 1 | C:\i386\ 2 | C:\Users\All Users\Microsoft Help\ 3 | C:\Users\All Users\Microsoft\ 4 | C:\msocache\ 5 | C:\Recycler\ 6 | C:\Program Files (x86)\ 7 | C:\Program Files\ 8 | C:\$recycler\ 9 | C:\$recycle.bin\ 10 | C:\windows\ 11 | D:\$recycler\ 12 | D:\Program Files\ 13 | D:\msocache\ 14 | D:\recycler\ 15 | D:\Program Files (x86)\ 16 | D:\Users\All Users\Microsoft\ 17 | D:\windows\ 18 | D:\$recycle.bin\ 19 | D:\i386\ 20 | D:\Users\All Users\Microsoft Help\ -------------------------------------------------------------------------------- /Call-Test.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | ECHO: 4 | ECHO Boxstarter Template ^( %~nx0 ^) & REM This script's file name and extension. https://ss64.com/nt/syntax-args.html 5 | ECHO Working directory: %~dp0 & REM The drive letter and path of this script's location. 6 | REM Bugfix: cannot use :: for comments within IF statement, instead use REM 7 | ECHO: 8 | 9 | ECHO Calling Test-ParameterWithSpaces.bat 10 | 11 | ::PAUSE 12 | 13 | CALL %~dp0\Test-ParameterWithSpaces.bat One "C:\Path with spaces\test.txt" Third 14 | 15 | ECHO: 16 | 17 | PAUSE 18 | 19 | EXIT /B 20 | -------------------------------------------------------------------------------- /startup/choco-upgrade.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | ECHO All outdated packages: 4 | 5 | choco outdated 6 | 7 | ECHO Upgrade packagaes: 8 | 9 | choco upgrade chocolatey -y 10 | choco upgrade discord -y 11 | choco upgrade Firefox -y 12 | choco upgrade git -y 13 | choco upgrade github-desktop -y 14 | choco upgrade GoogleChrome -y 15 | choco upgrade hg -y 16 | choco upgrade nextcloud-client -y 17 | choco upgrade notepadplusplus -y 18 | choco upgrade putty -y 19 | choco upgrade signal -y 20 | choco upgrade thunderbird -y 21 | choco upgrade TortoiseGit -y 22 | choco upgrade tortoisehg -y 23 | choco upgrade vlc -y 24 | choco upgrade vscodium -y 25 | 26 | 27 | -------------------------------------------------------------------------------- /functions/bat vs cmd files.txt: -------------------------------------------------------------------------------- 1 | 2 | https://stackoverflow.com/questions/148968/windows-batch-files-bat-vs-cmd 3 | 4 | answered Sep 29 '08 at 14:41 5 | Ben Hoffstein 6 | 7 | From this news group posting by Mark Zbikowski himself: 8 | 9 | `The differences between .CMD and .BAT as far as CMD.EXE is concerned are: With extensions enabled, PATH/APPEND/PROMPT/SET/ASSOC in .CMD files will set ERRORLEVEL regardless of error. .BAT sets ERRORLEVEL only on errors.` 10 | 11 | In other words, if ERRORLEVEL is set to non-0 and then you run one of those commands, the resulting ERRORLEVEL will be: 12 | 13 | - left alone at its non-0 value in a .bat file 14 | - reset to 0 in a .cmd file. 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /AutoHotKey/copynpaste-Access-table.ahk: -------------------------------------------------------------------------------- 1 | ; WARNING: For whatever reason {Enter} correctly sends the return key to most applications, except Notepad++ 2 | ; Test the script in regular Notepad to see if it works, or a blank version of the same application. 3 | 4 | ; A script for auto-filling a lot of bullshit data into an Access table. 5 | ; Got good speed out of adding data so set it fast. 6 | ; Luckily there is no extra keypress to edit so it's simple too. 7 | 8 | MsgBox Startup. Alt-Z to activate. ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." 9 | Return 10 | 11 | !z:: ; Alt-Z to activate 12 | Loop 130 ; WARNING! When using a Loop, don't forget you can't click away from the application while it types. 13 | { 14 | Send, ^v{Enter} ; This pastes the clipboard (Ctrl+V) and hits Return. 15 | Sleep 200 ; The number of milliseconds between keystrokes. 16 | } 17 | Return 18 | 19 | -------------------------------------------------------------------------------- /AutoHotKey/Numpad-Underscore.ahk: -------------------------------------------------------------------------------- 1 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 2 | #Warn ; Enable warnings to assist with detecting common errors. 3 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 4 | ; SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 5 | MsgBox, 6 | (LTrim 7 | Numpad Underscore shortcut enabled. 8 | 9 | Press Shift + Numpad(-) to print Underscore(_) 10 | 11 | (To stop this script right-click the AutoHotKey icon in the TaskBar notification tray, and select "Pause Script" or "Exit".) 12 | ) ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." 13 | Return 14 | 15 | ; !+v:: ; Alt+Shift+V to activate 16 | ; ^!v:: ; Ctrl+Alt+V to activate 17 | ; ^+v:: ; Ctrl+Shift+V to activate 18 | +NumpadSub:: ; Shift + Numpad hyphen/dash/minus (-) to activate 19 | SendInput _ ; Types the Underscore (_) character 20 | Return 21 | -------------------------------------------------------------------------------- /functions/RunAsAdministrator/ReadMe.md: -------------------------------------------------------------------------------- 1 | # How to use 2 | 3 | Paste one of these code blocks as far near the top of your script as possible, preferably right after `@ECHO OFF` and `SETLOCAL` lines. 4 | 5 | These snippets will restart your script from the beginning, and the more logic you try to add above the admin block tends to create more weird errors more often, so as close to the top as possible. 6 | 7 | For example: 8 | 9 | ```bat 10 | @ECHO OFF 11 | SETLOCAL EnableDelayedExpansion 12 | 13 | :: Description, Index, etc. 14 | 15 | :: <-- Paste a RunAsAdmin code block here --> 16 | 17 | ECHO Main script code. 18 | ECHO ... 19 | ECHO ... 20 | ECHO ... 21 | 22 | ENDLOCAL 23 | EXIT /B 24 | ``` 25 | - **BatchGotAdmin International-Fix Code.bat** - Short and compact, always runs the script as admin. 26 | - **SS64 Run with elevated permissions (ElevateMe.vbs).bat** - Has built-in options for disabling itself, prompting user whether to run as Admin or not, and input parameter logic so other scripts can call it as strictly Admin or non-Admin. 27 | -------------------------------------------------------------------------------- /Tools/Compare1.txt: -------------------------------------------------------------------------------- 1 | Write-Host "Repo name: $($obj.RepositoryName) `t`t`tType: $($obj.RepositoryType)`t`tSize: $($obj.Size)" 2 | $DestinationRepo = $Destination + "\" + $obj.RepositoryName 3 | If ($obj.RepositoryType -like "*Hg*") { 4 | Write-Host "HgRepo" 5 | hg clone -y $Source $DestinationRepo 6 | 7 | # Add remote sync paths. 8 | $CurrentDir = (Get-Location).Path 9 | Set-Location $DestinationRepo 10 | If (($obj.SourceUrlPath) -ne "" -and $null -ne ($obj.SourceUrlPath) -and ($obj.SourceUrlPath) -ne '') { 11 | Set-Location .hg 12 | $NewHgrc = (Get-Content hgrc) -replace "^default2", "default3" 13 | $NewHgrc = $NewHgrc -replace "^default", "default2" 14 | $NewHgrc = $NewHgrc -replace "\[paths\]", "[paths]`r`ndefault = $($obj.SourceUrlPath)" 15 | Set-Content -Path .\hgrc -Value $NewHgrc 16 | } 17 | Set-Location $CurrentDir 18 | } 19 | If ($obj.RepositoryType -like "*Git*") { 20 | Write-Host "GitRepo" 21 | If (($obj.SourceUrlPath) -eq "" -or $null -eq ($obj.SourceUrlPath) -or ($obj.SourceUrlPath) -eq '') { 22 | ======= -------------------------------------------------------------------------------- /save_RTMP_streams.bat: -------------------------------------------------------------------------------- 1 | 2 | :: get chocolatey 3 | 4 | @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" 5 | 6 | :: update environment vars so we don't have to re-open our shell 7 | 8 | CALL refreshenv 9 | 10 | :: install: VLC player, RTMPDump, RTMPDumpHelper 11 | 12 | choco install vlc -y 13 | choco install rtmpdump -y 14 | choco install rtmpdumphelper -y 15 | 16 | :: set paths to RTMPDump, RTMPDumpHelper 17 | 18 | @SET RTMPpath=%ChocolateyInstall%\lib\RTMPDump\tools\rtmpdump-2.3 19 | @SET RTMPhelperPath=%ChocolateyInstall%\lib\rtmpdumphelper\tools 20 | 21 | :: copy link to RTMPDump into RTMPDumpHelper directory 22 | 23 | MKLINK %RTMPhelperPath%\rtmpsuck.exe %RTMPpath%\rtmpsuck.exe 24 | MKLINK %RTMPhelperPath%\rtmpsrv.exe %RTMPpath%\rtmpsrv.exe 25 | 26 | :: run RTMPDumpHelper 27 | 28 | explorer.exe %RTMPhelperPath% 29 | %RTMPhelperPath%\RTMPDumpHelper.exe 30 | 31 | @ECHO: 32 | @ECHO All done! 33 | @ECHO: 34 | 35 | @PAUSE 36 | -------------------------------------------------------------------------------- /Tools/Compare2.txt: -------------------------------------------------------------------------------- 1 | <<<<<<< working copy 2 | Write-Host "Repo name: $($obj.RepositoryName) `t`t`tType: $($obj.RepositoryType)`t`tSize: $($obj.Size)" 3 | $DestinationRepo = $Destination + "\" + $obj.RepositoryName 4 | If ($obj.RepositoryType -like "*Hg*") { 5 | Write-Host "HgRepo" 6 | hg clone -y $Source $DestinationRepo 7 | 8 | # Add remote sync paths. 9 | $CurrentDir = (Get-Location).Path 10 | Set-Location $DestinationRepo 11 | If (($obj.SourceUrlPath) -ne "" -and $null -ne ($obj.SourceUrlPath) -and ($obj.SourceUrlPath) -ne '') { 12 | Set-Location .hg 13 | $NewHgrc = (Get-Content hgrc) -replace "^default2", "default3" 14 | $NewHgrc = $NewHgrc -replace "^default", "default2" 15 | $NewHgrc = $NewHgrc -replace "\[paths\]", "[paths]`r`ndefault = $($obj.SourceUrlPath)" 16 | Set-Content -Path .\hgrc -Value $NewHgrc 17 | } 18 | Set-Location $CurrentDir 19 | } 20 | If ($obj.RepositoryType -like "*Git*") { 21 | Write-Host "GitRepo" 22 | If (($obj.SourceUrlPath) -eq "" -or $null -eq ($obj.SourceUrlPath) -or ($obj.SourceUrlPath) -eq '') { 23 | ======= -------------------------------------------------------------------------------- /AutoHotKey/Lightworks/trim-fps.ahk: -------------------------------------------------------------------------------- 1 | killrepeat := false 2 | MsgBox % "Trim frames: Alt-z to execute. `nAlt-d or Alt-~ to try to stop." ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." And `n indicates a linefeed character. For breaking up even longer text, see MsgBox continuation section. 3 | Return 4 | 5 | !d:: ; Stop the loop. 6 | killrepeat := true 7 | MsgBox % "Operation halted." 8 | Return 9 | 10 | !`:: ; Stop the loop, while in Notepad editor 11 | killrepeat := true 12 | MsgBox % "Operation halted." 13 | Return 14 | 15 | !z:: 16 | Loop 29 17 | { 18 | Send ..is{Delete} ; Periods set the fps. 19 | Sleep 900 ; The number of milliseconds between keystrokes 20 | if killrepeat = true 21 | { 22 | break 23 | Return 24 | } 25 | } 26 | Return 27 | 28 | ; Old Version, still works: 29 | ; 30 | ; !z:: 31 | ; totalcycles := 1 32 | ; SetTimer, FramerateRepeat, 1000 33 | ; Return 34 | ; 35 | ; FramerateRepeat: 36 | ; if (totalcycles <> 60) 37 | ; { 38 | ; send, ...is{Delete} ; a comment. 39 | ; totalcycles += 1 40 | ; } 41 | ; Return 42 | 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | PowerShell/Task Tracker/Twilio-Auth.ps1 49 | PowerShell/modules/Task Tracker/Twilio-Auth.ps1 50 | *.orig 51 | *.log 52 | *.bak 53 | Linux/password.txt 54 | Linux/TEMPORARY_DELETE_ASAP.txt 55 | Documention/Site Survey.png 56 | Documention/User Projects/* 57 | /Remote Access/Enable-AdminShare/RegistryBackups/*.reg 58 | -------------------------------------------------------------------------------- /functions/RunAsAdministrator/BatchGotAdmin International-Fix Code.bat: -------------------------------------------------------------------------------- 1 | 2 | :RunAsAdministrator 3 | :: BatchGotAdmin International-Fix Code 4 | :: https://sites.google.com/site/eneerge/home/BatchGotAdmin 5 | :------------------------------------------------------------------------------- 6 | REM --> Check for permissions 7 | >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 8 | 9 | REM --> If error flag set, we do not have admin. 10 | IF '%ERRORLEVEL%' NEQ '0' ( 11 | ECHO Requesting administrative privileges... ^(waiting 2 seconds^) 12 | PING -n 3 127.0.0.1>nul 13 | GOTO UACPrompt 14 | ) ELSE ( GOTO gotAdmin ) 15 | 16 | :UACPrompt 17 | ECHO Set UAC = CreateObject^("Shell.Application"^) > "%Temp%\getadmin.vbs" 18 | ECHO UAC.ShellExecute "%~s0", "", "", "RUNAS", 1 >> "%Temp%\getadmin.vbs" 19 | 20 | "%Temp%\getadmin.vbs" 21 | EXIT /B 22 | 23 | :gotAdmin 24 | IF EXIST "%Temp%\getadmin.vbs" ( DEL "%Temp%\getadmin.vbs" ) 25 | PUSHD "%CD%" 26 | CD /D "%~dp0" 27 | ECHO BatchGotAdmin Permissions set. 28 | :------------------------------------------------------------------------------- 29 | :: End Run-As-Administrator function 30 | -------------------------------------------------------------------------------- /Refresh-Permissions.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | :: Refresh User's Group Permissions (without-logging-off-and-back-in) 3 | :: https://community.spiceworks.com/how_to/7562-refresh-user-s-group-membership-without-logging-off-and-on 4 | :: Bear in mind that any other programs they already had open (excel, word etc) won't be aware of the new group memebership though. 5 | :: When they next launch them from the start menu, desktop, or from double clicking a file, they will be aware of the new group membership as they will then be child processes of the new explorer.exe instance and therefore will inherit the security token from it. 6 | 7 | ::PS\> $UserCredential = Get-Credential 8 | 9 | ECHO Type in Username: (DOMAIN\username) e.g. IQ\jdoe 10 | SET /P Username= 11 | 12 | ::SET Username=IQ\gjames 13 | ::ECHO Username set: %Username% 14 | 15 | ::Verify password is valid before killing any processes? 16 | 17 | TASKKILL /F /IM explorer.exe 18 | 19 | RUNAS /user:%Username% explorer.exe 20 | 21 | ECHO. 22 | ECHO User permissions refreshed. 23 | ECHO. 24 | ECHO If you had any applications open, those apps will have to be closed and 25 | ECHO restarted to have the new permissions. 26 | ECHO. 27 | 28 | PAUSE 29 | -------------------------------------------------------------------------------- /AutoHotKey/Numpad-Underscore-v2.ahk: -------------------------------------------------------------------------------- 1 | #Warn ; Enable warnings to assist with detecting common errors. 2 | SendMode "Input" ; Recommended for new scripts due to its superior speed and reliability. 3 | ; SetWorkingDir A_InitialWorkingDir ; Ensures a consistent starting directory. (Forces the script to use the folder it was initially launched from as its working directory.) 4 | msgboxtitle := "Numpad Underscore shortcut enabled" 5 | message := ' 6 | ( 7 | Numpad Underscore shortcut enabled. 8 | 9 | Press "Shift + Numpad(-)" to print an Underscore(_) character. 10 | 11 | (To stop this script right-click the AutoHotKey icon in the TaskBar notification tray, and select "Pause Script" or "Exit".) 12 | )' 13 | ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." 14 | MsgBox Format(message, msgboxtitle) 15 | ;Return 16 | 17 | 18 | ; !+v:: ; Alt+Shift+V to activate 19 | ; ^!v:: ; Ctrl+Alt+V to activate 20 | ; ^+v:: ; Ctrl+Shift+V to activate 21 | +NumpadSub:: ; Shift + Numpad hyphen/dash/minus (-) to activate 22 | { 23 | SendInput "_" ; Types the Underscore (_) character 24 | } 25 | Return 26 | -------------------------------------------------------------------------------- /functions-template_param.bat: -------------------------------------------------------------------------------- 1 | 2 | REM ECHO DEBUGGING: Begin parameter script: %~nx0 & REM "%~dpnx0" = will return the Drive letter, Path, Name, & eXtention of this script. 3 | 4 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 | 6 | :: Param1 = File A 7 | 8 | SET "_FILE_A=%UserProfile%\Documents\GitHub\Batch-Tools-SysAdmin\powershell-template (2).bat" 9 | 10 | SET "_FILE_A=\\gammafox\C$\Users\G\Documents\SpiderOak Hive\Programming\Powershell\Templates\powershell-template.ps1" 11 | 12 | SET "_FILE_A=%~dpnx0" & REM "%~dpnx0" = will return the Drive letter, Path, Name, & eXtention of this script. 13 | 14 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 15 | 16 | :: Param2 = File B 17 | 18 | SET "_FILE_B=%UserProfile%\Documents\GitHub\Batch-Tools-SysAdmin\powershell-template (2).bat" 19 | 20 | SET "_FILE_B=\\gammafox\C$\Users\G\Documents\SpiderOak Hive\Programming\Powershell\Templates\powershell-template (2).ps1" 21 | 22 | SET "_FILE_B=%~dpnx0" & REM "%~dpnx0" = will return the Drive letter, Path, Name, & eXtention of this script. 23 | 24 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 25 | 26 | REM ECHO DEBUGGING: End of parameter script. 27 | -------------------------------------------------------------------------------- /Wireshark/tcpdump.txt: -------------------------------------------------------------------------------- 1 | 2 | ------------------------------------------------------------------------------- 3 | 4 | https://www.wireshark.org/docs/wsug_html_chunked/AppToolstcpdump.html 5 | https://linuxexplore.com/2012/06/07/use-tcpdump-to-capture-in-a-pcap-file-wireshark-dump/ 6 | 7 | Older versions of tcpdump truncate packets to 68 or 96 bytes. If this is the case, use -s to capture full-sized packets: 8 | -s 65535 9 | -s 0 will set the capture byte to its maximum i.e. 65535, after this capture file will not truncate. 10 | 11 | ------------------------------------------------------------------------------- 12 | 13 | https://community.ui.com/questions/packet-capture-to-remote-wireshark/d785f11c-42d3-4445-8cf6-a1a57ddabfd8 14 | 15 | sudo tcpdump -i eth0 -i eth1 -s 0 -w /home/getmo/packetcap/2019-10-05dump.pcap 16 | 17 | ------------------------------------------------------------------------------- 18 | 19 | File size in human-readable format: 20 | 21 | ls -lh 22 | ls -lah 23 | 24 | ------------------------------------------------------------------------------- 25 | 26 | Rename log file: 27 | 28 | mv 2019-10-05dump.pcap 2019-10-05dump_2.pcap 29 | 30 | ------------------------------------------------------------------------------- 31 | 32 | Clean-up log file: 33 | 34 | rm -f 2019-10-05dump.pcap 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /AutoHotKey/Lightworks/get-framecount.ahk: -------------------------------------------------------------------------------- 1 | killrepeat := false 2 | framecount := 0 3 | MsgBox % "Startup. `nAlt-c to Start Counting. `nAlt-d to Stop. `nAlt-z for Status Update. `nFrame count: " . framecount . ". `nKill repeat: " . killrepeat . "." ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." And `n indicates a linefeed character. For breaking up even longer text, see MsgBox continuation section. 4 | Return 5 | 6 | 7 | !d:: ; Stop the loop. 8 | killrepeat := true 9 | Sleep 100 ; The number of milliseconds between keystrokes 10 | framecount -= 1 11 | SendInput a ; 12 | Sleep 150 ; The number of milliseconds between keystrokes 13 | SendInput o ; 14 | Sleep 150 ; The number of milliseconds between keystrokes 15 | MsgBox % "Framecount halted. `nFinal count at mark: " . framecount . "." ; A period is used to concatenate (join) two strings. 16 | Return 17 | 18 | 19 | !c:: ; Start counting. 20 | While killrepeat = false 21 | { 22 | framecount += 1 23 | SendInput s ; since sending this activates this hotkey activates this function again, it creates a loop. 24 | Sleep 400 ; The number of milliseconds between keystrokes 25 | if killrepeat = true 26 | { 27 | break 28 | } 29 | } 30 | Return 31 | 32 | !z:: ; Status Update. 33 | MsgBox % "Frame count: " . framecount . ". `nKill repeat: " . killrepeat . "." ; A period is used to concatenate (join) two strings. 34 | Return 35 | -------------------------------------------------------------------------------- /Local Admin group membership.txt: -------------------------------------------------------------------------------- 1 | 2 | Query group membership: 3 | 4 | net user Kathy 5 | 6 | 7 | 8 | #### ----------------------------- 9 | 10 | # get local users 11 | 12 | > net users 13 | 14 | # get user details 15 | 16 | > net user users_name 17 | 18 | # Disable local administrator account 19 | 20 | > net user Administrator /active:no 21 | 22 | #### ----------------------------- 23 | 24 | #http://www.windows-commandline.com/remove-user-from-group-using-command/ 25 | 26 | # We can delete users from a group using command line too. We can use below net localgroup command for this. 27 | 28 | > net localgroup group_name user_name /delete 29 | 30 | # For example to remove user John from administrators group we can run the below command. 31 | 32 | > net localgroup Administrators John /delete 33 | 34 | # This command works on all editions of Windows OS i.e Windows 2000, Windows XP, Windows Server 2000, Windows Vista and Windows 7. In Vista and Windows 7, even if you run the above command from administrator login you may still get access denied error like below. 35 | 36 | C:\> net localgroup administrators techblogger /delete 37 | System error 5 has occurred. 38 | Access is denied. 39 | 40 | # The solution for this is to run the command from elevated administrator account. See how to open elevated administrator command prompt 41 | 42 | 43 | #### ----------------------------- 44 | 45 | # add use back to admin group 46 | 47 | net localgroup "PowerUsersGroupName""MemberName"/add 48 | 49 | net localgroup Administrators Kathy /add 50 | -------------------------------------------------------------------------------- /AutoHotKey/ImpossiblePaste.ahk: -------------------------------------------------------------------------------- 1 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 2 | #Warn ; Enable warnings to assist with detecting common errors. 3 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 4 | ; SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 5 | MsgBox, 6 | (LTrim 7 | Impossible Paste: Paste text into locked fields that block it. 8 | 9 | 1. Copy text normally (Ctrl+C). 10 | 2. Ctrl+Shift+V for Impossible Paste. 11 | 12 | (To stop this script right-click the AutoHotKey icon in the TaskBar notification tray, and select "Pause Script" or "Exit".) 13 | ) ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." 14 | Return 15 | 16 | ; Impossible Paste: 17 | ; Paste text into locked fields that block clipboard pasting, by allowing AHK to type the clipboard's contents via HID keyboard instead. 18 | ; (Remember to update the help text above if you change the activation hotkey below!) 19 | ; !+v:: ; Alt+Shift+V to activate 20 | ; ^!v:: ; Ctrl+Alt+V to activate 21 | ^+v:: ; Ctrl+Shift+V to activate 22 | ;Send, %Clipboard% ; Types the contents of the %Clipboard% variable (a built-in var) --- using the same method as the pre-1.0.43 Send command, synonymous with SendEvent. 23 | SendInput %Clipboard% ; Types the contents of the %Clipboard% variable (a built-in var) --- uses the same syntax as Send but is generally faster and more reliable. 24 | Return 25 | -------------------------------------------------------------------------------- /AutoHotKey/Format MAC address/FormatMACaddr.ahk: -------------------------------------------------------------------------------- 1 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 2 | #Warn ; Enable warnings to assist with detecting common errors. 3 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 4 | ; SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 5 | MsgBox, 6 | (LTrim 7 | Hotkey for formatting MAC addresses with colons (:) is active. 8 | 9 | E.g. B8A44FB9A975 to -> B8:A4:4F:B9:A9:75 10 | 11 | Press Ctrl + Shift + M to activate. 12 | 13 | (To stop this script right-click the AutoHotKey icon in the TaskBar notification tray, and select "Pause Script" or "Exit".) 14 | ) ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." 15 | Return 16 | 17 | ; !+v:: ; Alt+Shift+V to activate 18 | ; ^!v:: ; Ctrl+Alt+V to activate 19 | ; ^+v:: ; Ctrl+Shift+V to activate 20 | ^+m:: ; Ctrl+Shift+M to activate 21 | SendInput {F2} ; Presses the F2 key, which starts editing a cell in Excel/LibreOffice Calc 22 | Sleep 50 ; The number of milliseconds between keystrokes 23 | SendInput {Home} ; Presses the 'Home' key to return cursor to the front of line. 24 | SendInput {Right}{Right}: ; Press the right arrow key twice, then type a colon (:) 25 | SendInput {Right}{Right}: ; Press the right arrow key twice, then type a colon (:) 26 | SendInput {Right}{Right}: ; Press the right arrow key twice, then type a colon (:) 27 | SendInput {Right}{Right}: ; Press the right arrow key twice, then type a colon (:) 28 | SendInput {Right}{Right}: ; Press the right arrow key twice, then type a colon (:) 29 | Return 30 | -------------------------------------------------------------------------------- /AutoHotKey/ExtraKeys/TrueNAS-webshell-copypaste.ahk: -------------------------------------------------------------------------------- 1 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 2 | ; #Warn ; Enable warnings to assist with detecting common errors. 3 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 4 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 5 | MsgBox, 6 | (LTrim 7 | Script Startup: TrueNAS web shell Copy & Paste 8 | 9 | - Alt-C to Copy (Ctrl+Insert). 10 | 11 | - Alt-V to Paste (Shift+Insert). 12 | 13 | To stop this script, right-click the AutoHotKey icon in the TaskBar notification tray, and select 'Pause Script' or 'Exit'. 14 | ) ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." 15 | Return 16 | 17 | ; Script Description: 18 | ; Using the web shell for the TrueNAS web interface requires special keys to copy or paste to it. (Right click and Ctrl+C or Ctrl+V don't work.) 19 | 20 | ; The text reads as-is: 21 | ; Copy and Paste 22 | ; Context menu copy and paste operations are disabled in the Shell. Copy and paste shortcuts for Mac are Command+c and Command+v. For most operating systems, use Ctrl+Insert to copy and Shift+Insert to paste. 23 | 24 | ; However my laptop keyboard does not have an Insert key. So let's spoof it. In fact, let's spoof the whole shortcut(s). 25 | 26 | ; Copy 27 | +!c:: ; Alt-C to activate 28 | Send ^{Ins} ; Presses the keys Ctrl+Insert, the command for copy in TrueNAS web shell. 29 | Return 30 | 31 | ; Paste 32 | +!v:: ; Alt-V to activate 33 | Send +{Ins} ; Presses the keys Shift+Insert, the command for paste in TrueNAS web shell. 34 | Return 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /PowerShell/modules/Task Tracker/Track-SentHistory_ProductionRun.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM ------------------------------------------------------------------------------- 4 | REM =============================================================================== 5 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6 | 7 | :: https://ss64.com/nt/syntax-args.html 8 | SET "_HOME_PATH=%~dp0" 9 | 10 | SET "_HOME_NAME=%~n0" 11 | 12 | :: https://ss64.com/nt/syntax-substring.html 13 | :: Exctract everything BUT the last 14 characters 14 | SET "_SOURCE_NAME=%_HOME_NAME:~0,-14%.bat" 15 | :: Track-SentHistory_ProductionRun.bat 16 | :: 123456789012345678 17 | 18 | SET "_SOURCE_SCRIPT=%_HOME_PATH%%_SOURCE_NAME%" 19 | 20 | :: Create "production" copy in %Temp% directory 21 | SET "_PRODUCTION_PATH=%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%" 22 | 23 | MKDIR "%_PRODUCTION_PATH%" 24 | 25 | SET "_PRODUCTION_SCRIPT=%_PRODUCTION_PATH%\%_SOURCE_NAME%" 26 | 27 | COPY "%_SOURCE_SCRIPT%" "%_PRODUCTION_SCRIPT%" 28 | 29 | SET "_PARAMETERS=%_HOME_PATH%" 30 | CD /D "%_HOME_PATH%" 31 | 32 | ECHO: 33 | ECHO Running script = "%_PRODUCTION_SCRIPT%" 34 | ECHO: 35 | ECHO CD = "%CD%" 36 | ECHO: 37 | ECHO PRODUCTION RUN STARTING 38 | ECHO: 39 | PAUSE 40 | REM =============================================================================== 41 | 42 | CMD.EXE /C ""%_PRODUCTION_SCRIPT%" "%_PARAMETERS%"" 43 | 44 | REM =============================================================================== 45 | ECHO: 46 | ECHO Clean-up %~nx0 . . . 47 | 48 | DEL "%_PRODUCTION_SCRIPT%" 49 | RMDIR /S /Q "%_PRODUCTION_PATH%" 50 | 51 | ECHO: 52 | ECHO %_PRODUCTION_PATH% production run deleted. 53 | ECHO: 54 | ECHO End %~nx0 55 | ECHO: 56 | PAUSE 57 | EXIT /B 58 | -------------------------------------------------------------------------------- /AutoHotKey/IQ/IQ-Excel_FixPhoneNumbers.ahk: -------------------------------------------------------------------------------- 1 | ; WARNING: For whatever reason {Enter} correctly sends the return key to most applications, except Notepad++ 2 | ; Test the script in regular Notepad to see if it works, or a blank version of the same application. 3 | 4 | ; A script for auto-filling a lot of bullshit data into an Access table. 5 | ; Got good speed out of adding data so set it fast. 6 | ; Luckily there is no extra keypress to edit so it's simple too. 7 | 8 | MsgBox Startup. `nCtrl-Shift-X to activate for sequences like: "(602) 586-7342". `nAlt-D to activate for sequences like: "602-586-7342". ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." And `n indicates a linefeed character. For breaking up even longer text, see MsgBox continuation section. 9 | Return 10 | 11 | ^+x:: ; Ctrl-Shift-X to activate for sequences like: "(602) 586-7342". 12 | ; Send, {F2}{Left}{Left}{Left}{Left}{Backspace}{Left}{Left}{Left}{BS}{BS}{Left}{Left}{Left}{BS}{BS}{Enter} ; This presses keys F2, Left Arrow (x4), Backspace, Left Arrow (x3), Backspace (x2), Left Arrow (x3), Backspace (x2), and then Enter. 13 | SendInput, {F2}{Left}{Left}{Left}{Left}{Backspace}{Left}{Left}{Left}{BS}{BS}{Left}{Left}{Left}{BS}{BS}{Enter} ; This presses keys F2, Left Arrow (x4), Backspace, Left Arrow (x3), Backspace (x2), Left Arrow (x3), Backspace (x2), and then Enter. 14 | Sleep 150 ; The number of milliseconds between keystrokes 15 | Return 16 | 17 | !d:: ; Alt-D to activate for sequences like: "602-586-7342". 18 | SendInput, {F2}{Left}{Left}{Left}{Left}{Backspace}{Left}{Left}{Left}{Backspace}{Enter} ; This presses keys F2, Left Arrow (x4), Backspace, Left Arrow (x3), Backspace, and then Enter. 19 | Sleep 150 ; The number of milliseconds between keystrokes 20 | Return 21 | 22 | -------------------------------------------------------------------------------- /PowerShell/modules/Task Tracker/Twilio-Auth_template.ps1: -------------------------------------------------------------------------------- 1 | 2 | # ======================================================================================================================= 3 | 4 | # Twilio send SMS function: 5 | 6 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7 | 8 | # Check if environment variables are already set or not, and set them if not 9 | 10 | $NewEnvVarName = "" 11 | $NewEnvVarValue = "" 12 | 13 | Write-Verbose "Setting environment variables: $NewEnvVarName, $NewEnvVarValue" 14 | 15 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 16 | # ----------------------------------------------------------------------------------------------------------------------- 17 | 18 | # Update System Environment Variables (add to separate file and run once, make that file private) 19 | 20 | #[Environment]::SetEnvironmentVariable("TWILIO_ACCOUNT_SID", "your_account_sid", "User") 21 | [Environment]::SetEnvironmentVariable("TWILIO_ACCOUNT_SID", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "User") 22 | 23 | #[Environment]::SetEnvironmentVariable("TWILIO_AUTH_TOKEN", "your_auth_token", "User") 24 | [Environment]::SetEnvironmentVariable("TWILIO_AUTH_TOKEN", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "User") 25 | 26 | # Twilio Phone number to send SMS from 27 | [Environment]::SetEnvironmentVariable("TWILIO_NUMBER", "+12345678901", "User") 28 | 29 | # Phone number to send SMS to 30 | [Environment]::SetEnvironmentVariable("TWILIO_VERIFIED_CALLERID", "+12345678901", "User") 31 | 32 | # ----------------------------------------------------------------------------------------------------------------------- 33 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 34 | -------------------------------------------------------------------------------- /AutoHotKey/IQ/IQ-Excel_FixIMEINumbers.ahk: -------------------------------------------------------------------------------- 1 | ; WARNING: For whatever reason {Enter} correctly sends the return key to most applications, except Notepad++ 2 | ; Test the script in regular Notepad to see if it works, or a blank version of the same application. 3 | 4 | ; A script for auto-filling a lot of bullshit data into an Access table. 5 | ; Got good speed out of adding data so set it fast. 6 | ; Luckily there is no extra keypress to edit so it's simple too. 7 | 8 | MsgBox Startup. `nCtrl-Shift-X to activate for sequences like: "8914 8000 0014 7517 1418". `nAlt-D to activate for sequences like: "9900 0483 3818 374". ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." And `n indicates a linefeed character. For breaking up even longer text, see MsgBox continuation section. 9 | Return 10 | 11 | ^+x:: ; Ctrl-Shift-X to activate for sequences like: "8914 8000 0014 7517 1418". 12 | ; Send, {F2}{Left}{Left}{Left}{Left}{Backspace}{Left}{Left}{Left}{Left}{BS}{Left}{Left}{Left}{Left}{BS}{Left}{Left}{Left}{Left}{BS}{Enter} ; This presses keys F2, (Left Arrow (x4), Backspace) x4 times, and then Enter. 13 | SendInput, {F2}{Left}{Left}{Left}{Left}{Backspace}{Left}{Left}{Left}{Left}{BS}{Left}{Left}{Left}{Left}{BS}{Left}{Left}{Left}{Left}{BS}{Enter} ; This presses keys F2, (Left Arrow (x4), Backspace) x4 times, and then Enter. 14 | Sleep 150 ; The number of milliseconds between keystrokes 15 | Return 16 | 17 | !d:: ; Alt-D to activate for sequences like: "9900 0483 3818 374". 18 | SendInput, {F2}{Left}{Left}{Left}{Backspace}{Left}{Left}{Left}{Left}{Backspace}{Left}{Left}{Left}{Left}{Backspace}{Enter} ; This presses keys F2, Left Arrow (x3), Backspace, Left Arrow (x4), Backspace, Left Arrow (x4), Backspace, and then Enter. 19 | Sleep 150 ; The number of milliseconds between keystrokes 20 | Return 21 | 22 | -------------------------------------------------------------------------------- /AutoHotKey/IQ/IQ-CXT-FixQueries.ahk: -------------------------------------------------------------------------------- 1 | 2 | !d:: ; Lookup next query. (Alt + D) 3 | Sleep 100 ; The number of milliseconds between keystrokes 4 | SendInput ! ; Press the "Alt" key 5 | Sleep 150 ; The number of milliseconds between keystrokes 6 | SendInput f ; Press the "F" key 7 | Sleep 150 ; The number of milliseconds between keystrokes 8 | SendInput l ; Press the "L" key 9 | Sleep 150 ; The number of milliseconds between keystrokes 10 | SendInput +{TAB 2} ; Presses Shift-Tab 2 times. 11 | Sleep 150 ; The number of milliseconds between keystrokes 12 | SendInput Add a stop to route SAL ; Types "Add a stop to route SAL". 13 | Sleep 250 ; The number of milliseconds between keystrokes 14 | SendInput +{TAB} ; Presses "Shift + Tab". 15 | Sleep 150 ; The number of milliseconds between keystrokes 16 | SendInput {Home} ; Presses the "Home" key on keyboard. 17 | Return 18 | 19 | !e:: ; Fix Query. (Alt + E) 20 | Sleep 100 ; The number of milliseconds between keystrokes 21 | SendInput {Alt} ; Press the "Alt" key 22 | Sleep 300 ; The number of milliseconds between keystrokes 23 | Send ^q ; Presses "Ctrl + Q". 24 | Sleep 600 ; The number of milliseconds between keystrokes 25 | SendInput +{TAB} ; Presses "Shift + Tab". 26 | Sleep 500 ; The number of milliseconds between keystrokes 27 | SendInput EXEC{Space} ; Types "EXEC ". 28 | Sleep 450 ; The number of milliseconds between keystrokes 29 | SendInput +{TAB 2} ; Presses Shift-Tab 2 times. 30 | Sleep 450 ; The number of milliseconds between keystrokes 31 | SendInput {Enter} ; Presses the Enter key. 32 | Sleep 600 ; The number of milliseconds between keystrokes 33 | Send {Alt} ; Press the "Alt" key 34 | Sleep 400 ; The number of milliseconds between keystrokes 35 | SendInput f ; Press the "F" key 36 | Sleep 450 ; The number of milliseconds between keystrokes 37 | SendInput q ; Press the "Q" key 38 | Sleep 700 ; The number of milliseconds between keystrokes 39 | SendInput {Enter} ; Presses the Enter key. 40 | Sleep 450 ; The number of milliseconds between keystrokes 41 | SendInput {Enter} ; Presses the Enter key. 42 | Return 43 | -------------------------------------------------------------------------------- /Tools/Compare1.bat: -------------------------------------------------------------------------------- 1 | 2 | :RunAsAdministrator 3 | :: SS64 Run with elevated permissions script (ElevateMe.vbs) 4 | :: Thanks to: http://ss64.com/vb/syntax-elevate.html 5 | :------------------------------------------------------------------------------- 6 | :: First check if we are running As Admin/Elevated 7 | FSUTIL dirty query %SystemDrive% >nul 8 | IF %ERRORLEVEL% EQU 0 GOTO START 9 | 10 | GOTO START & REM <-- Leave this line in to always skip Elevation Prompt --> 11 | ::GOTO NOCHOICE & REM <-- Leave this line in to always Elevate to Administrator (skip choice) --> 12 | ECHO: 13 | ECHO CHOICE Loading... 14 | ECHO: 15 | :: https://ss64.com/nt/choice.html 16 | CHOICE /M "Run as Administrator?" 17 | IF ERRORLEVEL 2 GOTO START & REM No. 18 | IF ERRORLEVEL 1 REM Yes. 19 | :NOCHOICE 20 | 21 | :: wait 2 seconds, in case this user is not in Administrators group. (To prevent an infinite loop of UAC admin requests on a restricted user account.) 22 | ECHO Requesting administrative privileges... ^(waiting 2 seconds^) 23 | PING -n 3 127.0.0.1 > nul 24 | 25 | ::Create and run a temporary VBScript to elevate this batch file 26 | :: https://ss64.com/nt/syntax-args.html 27 | SET _batchFile=%~s0 28 | SET _batchFile=%~f0 29 | SET _Args=%* 30 | IF NOT [%_Args%]==[] ( 31 | REM double up any quotes 32 | REM https://ss64.com/nt/syntax-replace.html 33 | SET "_Args=%_Args:"=""%" 34 | REM Bugfix: cannot use :: for comments within IF statement, instead use REM 35 | ) 36 | :: https://ss64.com/nt/if.html 37 | IF ["%_Args%"] EQU [""] ( 38 | SET "_CMD_RUN=%_batchFile%" 39 | ) ELSE ( 40 | SET "_CMD_RUN=""%_batchFile%"" %_Args%" 41 | ) 42 | :: https://ss64.com/vb/shellexecute.html 43 | ECHO Set UAC = CreateObject^("Shell.Application"^) > "%Temp%\~ElevateMe.vbs" 44 | ECHO UAC.ShellExecute "CMD", "/C ""%_CMD_RUN%""", "", "RUNAS", 1 >> "%Temp%\~ElevateMe.vbs" 45 | :: ECHO UAC.ShellExecute "CMD", "/K ""%_batchFile% %_Args%""", "", "RUNAS", 1 >> "%temp%\~ElevateMe.vbs" 46 | 47 | cscript "%Temp%\~ElevateMe.vbs" 48 | EXIT /B 49 | 50 | :START 51 | :: set the current directory to the batch file location 52 | ::CD /D %~dp0 53 | :------------------------------------------------------------------------------- 54 | :: End Run-As-Administrator function 55 | -------------------------------------------------------------------------------- /Tools/Compare2.bat: -------------------------------------------------------------------------------- 1 | 2 | :RunAsAdministrator 3 | :: SS64 Run with elevated permissions script (ElevateMe.vbs) 4 | :: Thanks to: http://ss64.com/vb/syntax-elevate.html 5 | :------------------------------------------------------------------------------- 6 | :: First check if we are running As Admin/Elevated 7 | FSUTIL dirty query %SystemDrive% >nul 8 | IF %ERRORLEVEL% EQU 0 GOTO START 9 | 10 | ::GOTO START & REM <-- Leave this line in to always skip Elevation Prompt --> 11 | ::GOTO NOCHOICE & REM <-- Leave this line in to always Elevate to Administrator (skip choice) --> 12 | ECHO: 13 | ECHO CHOICE Loading... 14 | ECHO: 15 | :: https://ss64.com/nt/choice.html 16 | CHOICE /M "Run as Administrator?" 17 | IF ERRORLEVEL 2 GOTO START & REM No. 18 | IF ERRORLEVEL 1 REM Yes. 19 | :NOCHOICE 20 | 21 | :: wait 2 seconds, in case this user is not in Administrators group. (To prevent an infinite loop of UAC admin requests on a restricted user account.) 22 | ECHO Requesting administrative privileges... ^(waiting 2 seconds^) 23 | PING -n 3 127.0.0.1 > nul 24 | 25 | ::Create and run a temporary VBScript to elevate this batch file 26 | :: https://ss64.com/nt/syntax-args.html 27 | SET _batchFile=%~s0 28 | SET _batchFile=%~f0 29 | SET _Args=%* 30 | IF NOT [%_Args%]==[] ( 31 | REM double up any quotes 32 | REM https://ss64.com/nt/syntax-replace.html 33 | SET "_Args=%_Args:"=""%" 34 | REM Bugfix: cannot use :: for comments within IF statement, instead use REM 35 | ) 36 | :: https://ss64.com/nt/if.html 37 | IF ["%_Args%"] EQU [""] ( 38 | SET "_CMD_RUN=%_batchFile%" 39 | ) ELSE ( 40 | SET "_CMD_RUN=""%_batchFile%"" %_Args%" 41 | ) 42 | :: https://ss64.com/vb/shellexecute.html 43 | ECHO Set UAC = CreateObject^("Shell.Application"^) > "%Temp%\~ElevateMe.vbs" 44 | ECHO UAC.ShellExecute "CMD", "/C ""%_CMD_RUN%""", "", "RUNAS", 1 >> "%Temp%\~ElevateMe.vbs" 45 | :: ECHO UAC.ShellExecute "CMD", "/K ""%_batchFile% %_Args%""", "", "RUNAS", 1 >> "%temp%\~ElevateMe.vbs" 46 | 47 | cscript "%Temp%\~ElevateMe.vbs" 48 | EXIT /B 49 | 50 | :START 51 | :: set the current directory to the batch file location 52 | ::CD /D %~dp0 53 | :------------------------------------------------------------------------------- 54 | :: End Run-As-Administrator function 55 | -------------------------------------------------------------------------------- /PowerShell/Test-AdministratorPermissions.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .LINK 3 | https://www.jonathanmedd.net/2014/01/testing-for-admin-privileges-in-powershell.html 4 | 5 | .LINK 6 | https://devblogs.microsoft.com/scripting/weekend-scripter-welcome-to-the-powershell-information-stream/ 7 | #> 8 | 9 | #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 | 11 | #http://techgenix.com/powershell-functions-common-parameters/ 12 | # To enable common parameters in functions (-Verbose, -Debug, etc.) the following 2 lines must be present: 13 | #[cmdletbinding()] 14 | #Param() 15 | 16 | [cmdletbinding()] 17 | Param( 18 | $InformationPreference = 'Continue' 19 | ) 20 | 21 | #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 22 | 23 | #----------------------------------------------------------------------------------------------------------------------- 24 | function Test-IsAdmin { #----------------------------------------------------------------------------------------------- 25 | ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") 26 | } #--------------------------------------------------------------------------------------------------------------------- 27 | #----------------------------------------------------------------------------------------------------------------------- 28 | 29 | #======================================================================================================================= 30 | 31 | Write-Verbose "Begining of Main Execution block." 32 | 33 | Write-Information "Execution policy : '$(Get-ExecutionPolicy)'" #-InformationAction 'Continue' 34 | 35 | Write-Debug 'About to run "Test-IsAdmin" function and check output.' 36 | 37 | # Write-Host has parameters that change its display, for example, ForegroundColor and BackgroundColor. Write-Information does not. 38 | If ((Test-IsAdmin)) { 39 | Write-Host "Script is running with Administrator permissions!" -ForegroundColor "White" -BackgroundColor "Red" 40 | } Else { 41 | Write-Host "Script running with non-elevated permissions." -ForegroundColor "White" -BackgroundColor "Black" 42 | } 43 | 44 | Write-Verbose "End of Main Execution block." 45 | 46 | PAUSE 47 | 48 | #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 49 | 50 | Return 51 | -------------------------------------------------------------------------------- /functions/splash/clock-ascii-art.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | REM ------------------------------------------------------------------------------- 5 | REM =============================================================================== 6 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7 | 8 | 9 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 | # ======================================================================================================================= 11 | # ----------------------------------------------------------------------------------------------------------------------- 12 | 13 | https://www.asciiart.eu/electronics/clocks 14 | 15 | Alarm clock 16 | 17 | .-.-. 18 | (( (__I__) )) 19 | .'_....._'. 20 | / / .12 . \ \ 21 | | | ' | ' | | 22 | | | 9 / 3 | | 23 | \ \ '.6.' / / 24 | '.`-...-'.' 25 | jgs /'-- --'\ 26 | `"""""""""` 27 | 28 | 29 | # ----------------------------------------------------------------------------------------------------------------------- 30 | 31 | https://www.asciiart.eu/electronics/clocks 32 | 33 | 34 | -=[ stopwatch ]=- 8/99 35 | .--. 36 | .-._;.--.;_.-. 37 | (_.'_..--.._'._) 38 | /.' . 60 . '.\ 39 | // . / . \\ 40 | |; . / . |; 41 | ||45 () 15|| 42 | |; . . |; 43 | \\ . . // 44 | \'._' 30 '_.'/ 45 | jgs '-._'--'_.-' 46 | `""` 47 | 48 | # ----------------------------------------------------------------------------------------------------------------------- 49 | 50 | 51 | # ----------------------------------------------------------------------------------------------------------------------- 52 | 53 | 54 | # ----------------------------------------------------------------------------------------------------------------------- 55 | 56 | 57 | # ----------------------------------------------------------------------------------------------------------------------- 58 | 59 | 60 | # ----------------------------------------------------------------------------------------------------------------------- 61 | 62 | 63 | # ----------------------------------------------------------------------------------------------------------------------- 64 | 65 | 66 | # ----------------------------------------------------------------------------------------------------------------------- 67 | 68 | 69 | # ----------------------------------------------------------------------------------------------------------------------- 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /functions/RunAsAdministrator/SS64 Run with elevated permissions (ElevateMe.vbs).bat: -------------------------------------------------------------------------------- 1 | 2 | REM Bugfix: Use "REM ECHO DEBUG*ING: " instead of "::ECHO DEBUG*ING: " to comment-out debugging lines, in case any are within IF statements. 3 | REM ECHO DEBUGGING: Begin RunAsAdministrator block. 4 | 5 | :RunAsAdministrator 6 | :: SS64 Run with elevated permissions script (ElevateMe.vbs) 7 | :: Thanks to: http://ss64.com/vb/syntax-elevate.html 8 | :------------------------------------------------------------------------------- 9 | :: First check if we are already running As Admin/Elevated 10 | FSUTIL dirty query %SystemDrive% >nul 11 | IF %ERRORLEVEL% EQU 0 SET "_ADMIN=TRUE" & GOTO START 12 | 13 | :: Check input parameters 14 | REM ECHO DEBUGGING: Parameter %%1: "%1" 15 | IF "%1"=="RunAsAdmin" GOTO RUNASADMIN 16 | IF "%1"=="NoAdmin" GOTO SKIPADMIN 17 | 18 | ::GOTO SKIPADMIN & REM <-- Leave this line in to always skip Elevation Prompt --> 19 | ::GOTO RUNASADMIN & REM <-- Leave this line in to always Run As Administrator (skip choice) --> 20 | :: Comment out both GOTO statements to prompt user to elevate. 21 | ECHO: 22 | ECHO CHOICE Loading... 23 | ECHO: 24 | :: https://ss64.com/nt/choice.html 25 | CHOICE /M "Run as Administrator? (CMD.EXE/VBScript elevation)" 26 | IF ERRORLEVEL 2 GOTO SKIPADMIN & REM No. 27 | IF ERRORLEVEL 1 REM Yes. 28 | :RUNASADMIN 29 | 30 | :: wait 2 seconds, in case this user is not in Administrators group. (To prevent an infinite loop of UAC admin requests on a restricted user account.) 31 | ECHO Requesting administrative privileges... ^(waiting 2 seconds^) 32 | PING -n 3 127.0.0.1 > nul 33 | 34 | ::Create and run a temporary VBScript to elevate this batch file 35 | :: https://ss64.com/nt/syntax-args.html 36 | SET _batchFile=%~s0 37 | SET _batchFile=%~f0 38 | SET _Args=%* 39 | IF NOT [%_Args%]==[] ( 40 | REM double up any quotes 41 | REM https://ss64.com/nt/syntax-replace.html 42 | SET "_Args=%_Args:"=""%" 43 | REM Bugfix: cannot use :: for comments within IF statement, instead use REM 44 | ) 45 | :: https://ss64.com/nt/if.html 46 | IF ["%_Args%"] EQU [""] ( 47 | SET "_CMD_RUN=%_batchFile%" 48 | ) ELSE ( 49 | SET "_CMD_RUN=""%_batchFile%"" %_Args%" 50 | ) 51 | :: https://ss64.com/vb/shellexecute.html 52 | ECHO Set UAC = CreateObject^("Shell.Application"^) > "%Temp%\~ElevateMe.vbs" 53 | ECHO UAC.ShellExecute "CMD", "/C ""%_CMD_RUN%""", "", "RUNAS", 1 >> "%Temp%\~ElevateMe.vbs" 54 | :: ECHO UAC.ShellExecute "CMD", "/K ""%_batchFile% %_Args%""", "", "RUNAS", 1 >> "%temp%\~ElevateMe.vbs" 55 | 56 | cscript "%Temp%\~ElevateMe.vbs" 57 | EXIT /B 58 | 59 | GOTO START 60 | :SKIPADMIN 61 | SET "_ADMIN=FALSE" 62 | :START 63 | :: set the current directory to the batch file location 64 | ::CD /D %~dp0 65 | :------------------------------------------------------------------------------- 66 | :: End Run-As-Administrator function 67 | -------------------------------------------------------------------------------- /AutoHotKey/Notepad++/FindAndReplace-PowerShell_Index.ahk: -------------------------------------------------------------------------------- 1 | ; WARNING: For whatever reason {Enter} correctly sends the return key to most applications, except Notepad++ 2 | ; Test the script in regular Notepad to see if it works, or a blank version of the same application. 3 | 4 | MsgBox Notepad++ Find-and-Replace (1 space) function `n`nCtrl-Shift-X = to activate Part 1 of Find-and-Replace function. `nAlt-D = to activate Part 2 of Find-and-Replace function. ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." And `n indicates a linefeed character. For breaking up even longer text, see MsgBox continuation section. 5 | Return 6 | 7 | ^+x:: ; Ctrl-Shift-X to activate Part 1 of Find-and-Replace function. 8 | SendInput, {Home}{ShiftDown}{End}{ShiftUp} ; This presses keys: Home, holds down Shift, End, releases Shift - (Select entire line) 9 | Sleep 150 ; The number of milliseconds between keystrokes 10 | 11 | SendInput, {CtrlDown}{c}{h}{CtrlUp}{Tab} ; This presses keys: holds down Ctrl, C, H, releases Ctrl, Tab = (Ctrl+C = Copy to clipboard), (Ctrl+H = Replace) 12 | Sleep 150 ; The number of milliseconds between keystrokes 13 | 14 | SendInput, {CtrlDown}{v}{CtrlUp} ; This presses keys: holds down Ctrl, V, releases Ctrl = Ctrl+V (Paste from clipboard) 15 | ;Send ^v ; This presses keys: Ctrl+V (Paste from clipboard) 16 | Sleep 150 ; The number of milliseconds between keystrokes 17 | 18 | SendInput, {Home}{Right}{Delete} ; This presses keys: Home, Right Arrow, Delete 19 | Sleep 150 ; The number of milliseconds between keystrokes 20 | 21 | Return 22 | 23 | !d:: ; Alt-D to activate Part 2 of Find-and-Replace function. 24 | SendInput, {CtrlDown}{a}{CtrlUp} ; This presses keys: holds down Ctrl, A, releases Ctrl = Ctrl+A (Select All) 25 | ;Send ^a ; This presses keys: Ctrl+A (Select All) 26 | Sleep 150 ; The number of milliseconds between keystrokes 27 | 28 | SendInput, {CtrlDown}{c}{CtrlUp} ; This presses keys: holds down Ctrl, C, releases Ctrl = Ctrl+C (Copy to clipboard) 29 | ;Send ^c ; This presses keys: Ctrl+C (Copy to clipboard) 30 | Sleep 150 ; The number of milliseconds between keystrokes 31 | 32 | SendInput, {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab} ; This presses keys: Tab x10 times 33 | Sleep 150 ; The number of milliseconds between keystrokes 34 | 35 | Sleep 500 ; The number of milliseconds between keystrokes 36 | 37 | SendInput, {Enter} ; This presses keys: Enter 38 | Sleep 150 ; The number of milliseconds between keystrokes 39 | 40 | Sleep 1000 ; The number of milliseconds between keystrokes 41 | 42 | SendInput, {Escape} ; This presses keys: Esc 43 | Sleep 150 ; The number of milliseconds between keystrokes 44 | 45 | Sleep 500 ; The number of milliseconds between keystrokes 46 | 47 | SendInput, {Down}{Home} ; This presses keys: Down Arrow, Home 48 | Sleep 150 ; The number of milliseconds between keystrokes 49 | 50 | Return 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /AutoHotKey/Notepad++/FindAndReplace-PowerShell_Index2.ahk: -------------------------------------------------------------------------------- 1 | ; WARNING: For whatever reason {Enter} correctly sends the return key to most applications, except Notepad++ 2 | ; Test the script in regular Notepad to see if it works, or a blank version of the same application. 3 | 4 | MsgBox Notepad++ Find-and-Replace (2 spaces) function `n`nCtrl-Shift-X = to activate Part 1 of Find-and-Replace function. `nAlt-D = to activate Part 2 of Find-and-Replace function. ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." And `n indicates a linefeed character. For breaking up even longer text, see MsgBox continuation section. 5 | Return 6 | 7 | ^+x:: ; Ctrl-Shift-X to activate Part 1 of Find-and-Replace function. 8 | SendInput, {Home}{ShiftDown}{End}{ShiftUp} ; This presses keys: Home, holds down Shift, End, releases Shift - (Select entire line) 9 | Sleep 150 ; The number of milliseconds between keystrokes 10 | 11 | SendInput, {CtrlDown}{c}{h}{CtrlUp}{Tab} ; This presses keys: holds down Ctrl, C, H, releases Ctrl, Tab = (Ctrl+C = Copy to clipboard), (Ctrl+H = Replace) 12 | Sleep 150 ; The number of milliseconds between keystrokes 13 | 14 | SendInput, {CtrlDown}{v}{CtrlUp} ; This presses keys: holds down Ctrl, V, releases Ctrl = Ctrl+V (Paste from clipboard) 15 | ;Send ^v ; This presses keys: Ctrl+V (Paste from clipboard) 16 | Sleep 150 ; The number of milliseconds between keystrokes 17 | 18 | SendInput, {Home}{Right}{Right}{Delete} ; This presses keys: Home, Right Arrow, Delete 19 | Sleep 150 ; The number of milliseconds between keystrokes 20 | 21 | Return 22 | 23 | !d:: ; Alt-D to activate Part 2 of Find-and-Replace function. 24 | SendInput, {CtrlDown}{a}{CtrlUp} ; This presses keys: holds down Ctrl, A, releases Ctrl = Ctrl+A (Select All) 25 | ;Send ^a ; This presses keys: Ctrl+A (Select All) 26 | Sleep 150 ; The number of milliseconds between keystrokes 27 | 28 | SendInput, {CtrlDown}{c}{CtrlUp} ; This presses keys: holds down Ctrl, C, releases Ctrl = Ctrl+C (Copy to clipboard) 29 | ;Send ^c ; This presses keys: Ctrl+C (Copy to clipboard) 30 | Sleep 150 ; The number of milliseconds between keystrokes 31 | 32 | SendInput, {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab} ; This presses keys: Tab x10 times 33 | Sleep 150 ; The number of milliseconds between keystrokes 34 | 35 | Sleep 500 ; The number of milliseconds between keystrokes 36 | 37 | SendInput, {Enter} ; This presses keys: Enter 38 | Sleep 150 ; The number of milliseconds between keystrokes 39 | 40 | Sleep 1000 ; The number of milliseconds between keystrokes 41 | 42 | SendInput, {Escape} ; This presses keys: Esc 43 | Sleep 150 ; The number of milliseconds between keystrokes 44 | 45 | Sleep 500 ; The number of milliseconds between keystrokes 46 | 47 | SendInput, {Down}{Home} ; This presses keys: Down Arrow, Home 48 | Sleep 150 ; The number of milliseconds between keystrokes 49 | 50 | Return 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /functions/splash/tomato-ascii-art.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | REM ------------------------------------------------------------------------------- 7 | REM =============================================================================== 8 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9 | 10 | 11 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12 | # ======================================================================================================================= 13 | # ----------------------------------------------------------------------------------------------------------------------- 14 | 15 | 16 | http://ascii.co.uk/art/tomato 17 | 18 | , 19 | /.\ 20 | //_`\ 21 | _.-`| \ ``._ 22 | .-''`-. _.'`. 23 | .' / /'\/`.\ `. 24 | / . |/ `. \ 25 | ' / \ ; 26 | : ' \ : : 27 | ; ; ; / . 28 | ' : . ' / 29 | \ \ / .' 30 | LGB `.` .' .' 31 | `-..___....----` 32 | 33 | 34 | 35 | 36 | 37 | # ----------------------------------------------------------------------------------------------------------------------- 38 | 39 | http://www.asciiartfarts.com/20121006.html 40 | 41 | , 42 | /.\ 43 | //_`\ 44 | _.-`| \ ``._ 45 | .-''`-. _.'`. WHOSOEVER EATETH ME 46 | .' / /'\/`.\ `. LIKES SHIT THAT LOOKS FUNNY 47 | / . |/ `. \ THAT ALSO TASTES FUNNY 48 | ' / \ ; (AS WELL AS LOOKS FUNNY) 49 | : ' \ : : 50 | ; ; ; / . 51 | ' : . ' / 52 | \ \ / .' 53 | LGB `.` .' .' 54 | `-..___....----` 55 | 56 | # ----------------------------------------------------------------------------------------------------------------------- 57 | 58 | 59 | # ----------------------------------------------------------------------------------------------------------------------- 60 | 61 | 62 | # ----------------------------------------------------------------------------------------------------------------------- 63 | 64 | 65 | # ----------------------------------------------------------------------------------------------------------------------- 66 | 67 | 68 | # ----------------------------------------------------------------------------------------------------------------------- 69 | 70 | 71 | # ----------------------------------------------------------------------------------------------------------------------- 72 | 73 | 74 | # ----------------------------------------------------------------------------------------------------------------------- 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /AutoHotKey/Format MAC address/test.ahk: -------------------------------------------------------------------------------- 1 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 2 | #Warn ; Enable warnings to assist with detecting common errors. 3 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 4 | ; SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 5 | 6 | text := " text " 7 | MsgBox % "No trim:`t '" text "'" 8 | . "`nTrim:`t '" Trim(text) "'" 9 | . "`nLTrim:`t '" LTrim(text) "'" 10 | . "`nRTrim:`t '" RTrim(text) "'" 11 | Return 12 | 13 | MsgBox, 14 | (LTrim 15 | "AutoHotKey version is: " . A_AhkVersion . ". end." 16 | ) ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." 17 | Return 18 | 19 | 20 | text := " text " 21 | MsgBox % "No trim:`t '" text "'" 22 | . "`nTrim:`t '" Trim(text) "'" 23 | . "`nLTrim:`t '" LTrim(text) "'" 24 | . "`nRTrim:`t '" RTrim(text) "'" 25 | Return 26 | 27 | 28 | MsgBox, 29 | % (LTrim( 30 | "Hotkey for formatting MAC addresses with colons (:) is active." . 31 | 32 | "E.g. B8A44FB9A975 to -> B8:A4:4F:B9:A9:75" . 33 | 34 | "Press Ctrl + Shift + M to activate.") 35 | 36 | "AutoHotKey version is: " . A_AhkVersion . "."" 37 | 38 | "(To stop this script right-click the AutoHotKey icon in the TaskBar notification tray, and select ""Pause Script"" or ""Exit"".)" 39 | ) ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." 40 | Return 41 | 42 | 43 | 44 | ;MsgBox % "Startup. `nAlt-c to Start Counting. `nAlt-d to Stop. `nAlt-z for Status Update. `nFrame count: " . framecount . ". `nKill repeat: " . killrepeat . "." ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." And `n indicates a linefeed character. For breaking up even longer text, see MsgBox continuation section. 45 | 46 | 47 | ;MsgBox % "Startup. `nAlt-c to Start Counting. `nAlt-d to Stop. `nAlt-z for Status Update. `nFrame count: " . framecount . ". `nKill repeat: " . killrepeat . "." ; A period is used to concatenate (join) two strings, and % is used to designate a expression. E.g.: MsgBox % "Kill repeat: " . killrepeat . "." And `n indicates a linefeed character. For breaking up even longer text, see MsgBox continuation section. 48 | 49 | ; !+v:: ; Alt+Shift+V to activate 50 | ; ^!v:: ; Ctrl+Alt+V to activate 51 | ; ^+v:: ; Ctrl+Shift+V to activate 52 | ^+m:: ; Ctrl+Shift+M to activate 53 | SendInput {F2} ; Presses the F2 key, which starts editing a cell in Excel/LibreOffice Calc 54 | Sleep 50 ; The number of milliseconds between keystrokes 55 | SendInput {Home} ; Presses the 'Home' key to return cursor to the front of line. 56 | SendInput {Right}{Right}: ; Press the right arrow key twice, then type a colon (:) 57 | SendInput {Right}{Right}: ; Press the right arrow key twice, then type a colon (:) 58 | SendInput {Right}{Right}: ; Press the right arrow key twice, then type a colon (:) 59 | SendInput {Right}{Right}: ; Press the right arrow key twice, then type a colon (:) 60 | SendInput {Right}{Right}: ; Press the right arrow key twice, then type a colon (:) 61 | Return 62 | -------------------------------------------------------------------------------- /Update-MyApps.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ::SETLOCAL EnableDelayedExpansion 3 | 4 | REM Bugfix: Use "REM ECHO DEBUG*ING: " instead of "::ECHO DEBUG*ING: " to comment-out debugging lines, in case any are within IF statements. 5 | REM ECHO DEBUGGING: Begin RunAsAdministrator block. 6 | 7 | :RunAsAdministrator 8 | :: SS64 Run with elevated permissions script (ElevateMe.vbs) 9 | :: Thanks to: http://ss64.com/vb/syntax-elevate.html 10 | :------------------------------------------------------------------------------- 11 | :: First check if we are already running As Admin/Elevated 12 | FSUTIL dirty query %SystemDrive% >nul 13 | IF %ERRORLEVEL% EQU 0 SET "_ADMIN=TRUE" & GOTO START 14 | 15 | :: Check input parameters 16 | REM ECHO DEBUGGING: Parameter %%1: "%1" 17 | IF "%1"=="RunAsAdmin" GOTO RUNASADMIN 18 | IF "%1"=="NoAdmin" GOTO SKIPADMIN 19 | 20 | ::GOTO SKIPADMIN & REM <-- Leave this line in to always skip Elevation Prompt --> 21 | ::GOTO RUNASADMIN & REM <-- Leave this line in to always Run As Administrator (skip choice) --> 22 | :: Comment out both GOTO statements to prompt user to elevate. 23 | ECHO: 24 | ECHO CHOICE Loading... 25 | ECHO: 26 | :: https://ss64.com/nt/choice.html 27 | CHOICE /M "Run as Administrator? (CMD.EXE/VBScript elevation)" 28 | IF ERRORLEVEL 2 GOTO SKIPADMIN & REM No. 29 | IF ERRORLEVEL 1 REM Yes. 30 | :RUNASADMIN 31 | 32 | :: wait 2 seconds, in case this user is not in Administrators group. (To prevent an infinite loop of UAC admin requests on a restricted user account.) 33 | ECHO Requesting administrative privileges... ^(waiting 2 seconds^) 34 | PING -n 3 127.0.0.1 > nul 35 | 36 | ::Create and run a temporary VBScript to elevate this batch file 37 | :: https://ss64.com/nt/syntax-args.html 38 | SET _batchFile=%~s0 39 | SET _batchFile=%~f0 40 | SET _Args=%* 41 | IF NOT [%_Args%]==[] ( 42 | REM double up any quotes 43 | REM https://ss64.com/nt/syntax-replace.html 44 | SET "_Args=%_Args:"=""%" 45 | REM Bugfix: cannot use :: for comments within IF statement, instead use REM 46 | ) 47 | :: https://ss64.com/nt/if.html 48 | IF ["%_Args%"] EQU [""] ( 49 | SET "_CMD_RUN=%_batchFile%" 50 | ) ELSE ( 51 | SET "_CMD_RUN=""%_batchFile%"" %_Args%" 52 | ) 53 | :: https://ss64.com/vb/shellexecute.html 54 | ECHO Set UAC = CreateObject^("Shell.Application"^) > "%Temp%\~ElevateMe.vbs" 55 | ECHO UAC.ShellExecute "CMD", "/C ""%_CMD_RUN%""", "", "RUNAS", 1 >> "%Temp%\~ElevateMe.vbs" 56 | :: ECHO UAC.ShellExecute "CMD", "/K ""%_batchFile% %_Args%""", "", "RUNAS", 1 >> "%temp%\~ElevateMe.vbs" 57 | 58 | cscript "%Temp%\~ElevateMe.vbs" 59 | EXIT /B 60 | 61 | GOTO START 62 | :SKIPADMIN 63 | SET "_ADMIN=FALSE" 64 | :START 65 | :: set the current directory to the batch file location 66 | ::CD /D %~dp0 67 | :------------------------------------------------------------------------------- 68 | :: End Run-As-Administrator function 69 | 70 | choco upgrade notepadplusplus GoogleChrome Firefox vscode vscodium keepass nextcloud-client dropbox signal putty vlc wireshark nmap filezilla thunderbird paint.net discord steam epicgameslauncher -y 71 | ::choco upgrade telegram -y 72 | ::choco upgrade libreoffice -7 73 | ::choco upgrade libreoffice-fresh -7 74 | choco upgrade hg git tortoisegit tortoisehg github-desktop -y 75 | ::choco upgrade javaruntime jre8 -y 76 | 77 | ECHO End of script. 78 | PAUSE 79 | 80 | ::ENDLOCAL 81 | EXIT /B 82 | 83 | -------------------------------------------------------------------------------- /AutoHotKey/HatOfGod_edit.style.properties: -------------------------------------------------------------------------------- 1 | # HatOfGod - A happydark theme 2 | # 3 | # Made by budRich based on tidRich_Zenburn 4 | # Use it, change it, sell it. I don't care. 5 | # 6 | # Update: 7 | # 2011-08-19 8 | # Added Output pane styling. 9 | # 10 | # 2011-08-10 11 | # Stole the top part from nimdAHK's post, thanks mate! 12 | # Added global default style. Now other filetypes except AHK looks goodie. 13 | # Last lines are styles for ini and properties files. 14 | # 15 | # Check out the SciTE Styles forum thread. 16 | # http://www.autohotkey.com/forum/viewtopic.php?t=75188 17 | 18 | # Global default styles for all languages 19 | style.*.32=fore:#CCCCCC,back:#000000,font:Bitstream Vera Sans Mono,size:12 20 | 21 | # Caret 22 | caret.fore=#FFFFFF 23 | caret.line.back=#151515 24 | 25 | # Selection 26 | # 00005e BSoD blue. 27 | selection.back=#00005e 28 | selection.fore=#FFFFFF 29 | 30 | # Line number 31 | style.*.33=fore:#E4E4E4,back:#333333,$(font.base) 32 | 33 | # Fold Margin 34 | fold.margin.colour=#222222 35 | fold.margin.highlight.colour=#222222 36 | 37 | # Output pane 38 | style.errorlist.32=back:#111111,fore:#ff0000,font:Bitstream Vera Sans Mono,size:11 39 | style.errorlist.4=fore:#BBBBBB 40 | 41 | # Output pane ??? 42 | style.errorlist.1=fore:#0000AA,bold 43 | style.errorlist.3=fore:#F00000,bold 44 | style.errorlist.10=fore:#007F00 45 | style.errorlist.11=fore:#00007F 46 | style.errorlist.12=fore:#007F7F 47 | style.errorlist.13=fore:#7F0000 48 | 49 | # Ahk only 50 | 51 | # Base (background, base font) 52 | #~ style.ahk1.32=back:#000000,font:Bitstream Vera Sans Mono 53 | 54 | # Default (everything not below: spaces, untyped parameters) 55 | style.ahk1.0=fore:#CBCBAB,bold 56 | 57 | # Line comment (; syntax) 58 | style.ahk1.1=fore:#888888,italics 59 | 60 | # Block comment (/*...*/ syntax) 61 | style.ahk1.2=fore:#BBBBBB 62 | 63 | # Escape (`x) 64 | style.ahk1.3=fore:#789EC6,bold 65 | 66 | # Operator 67 | style.ahk1.4=fore:#97C0EB,bold 68 | 69 | # Expression assignement operator 70 | style.ahk1.5=fore:#F09EC0,bold 71 | 72 | # String 73 | style.ahk1.6=fore:#BBBBBB,bold 74 | 75 | # Number 76 | style.ahk1.7=fore:#FD971F,bold 77 | 78 | # Identifier (variable & function call) 79 | # Not used by the lexer but by the style below and by hotkeys 80 | style.ahk1.8=fore:#93CCB8 81 | 82 | # Variable dereferencing %varName% 83 | style.ahk1.9=$(style.ahk1.8),back:#000000,bold 84 | 85 | # Label & Hotstrings (& Function definition?). Also defines a bit of style for hotkeys. 86 | style.ahk1.10=fore:#C23669 87 | 88 | # Keyword - Flow of control 89 | style.ahk1.11=fore:#A6E22E,bold,italics 90 | 91 | 92 | # Keyword - Commands 93 | style.ahk1.12=fore:#F79B57,bold 94 | 95 | # Keyword - Functions 96 | style.ahk1.13=fore:#7CC8CF,italics 97 | 98 | # Keyword - Directives 99 | style.ahk1.14=fore:#7CC8CF,bold,italics 100 | 101 | # Keyword - Keys & buttons 102 | style.ahk1.15=fore:#CB8DD9,bold 103 | 104 | # Keyword - Built-in Variables 105 | style.ahk1.16=fore:#FF2679,bold,italics 106 | 107 | # Keyword - special parameters ("Keywords") 108 | style.ahk1.17=fore:#FFE000 109 | 110 | # Keyword - User defined 111 | style.ahk1.18=fore:#0000FF,bold 112 | 113 | # Variable keyword (built-in) dereferencing %A_xxx% 114 | style.ahk1.19=$(style.ahk1.16),back:#000000 115 | 116 | # Error (unclosed string, unknown operator, invalid dereferencing, etc.) 117 | style.ahk1.20=back:#111111,fore:#ff0000 118 | 119 | # .ini and .properties files 120 | 121 | # Default 122 | style.props.0=$(style.ahk1.0) 123 | 124 | # Comment 125 | style.props.1=$(style.ahk1.1) 126 | 127 | # Section 128 | style.props.2=$(style.ahk1.10),eolfilled 129 | 130 | # Assignment operator 131 | style.props.3=$(style.ahk1.5) 132 | 133 | # Key 134 | style.props.5=$(style.ahk1.8) 135 | -------------------------------------------------------------------------------- /PowerShell/comp1.bat: -------------------------------------------------------------------------------- 1 | 2 | ::Banner.cmd 3 | :------------------------------------------------------------------------------- 4 | ::CALL "%_BANNER_FUNC%" 12345678901234 5 | ::CALL "%_BANNER_FUNC%" 123456789012345678901 6 | ::CALL "%_BANNER_FUNC%" A-Z, 0-9, . @ 7 | :: Maximum string length is 14. (For CMD) 8 | :: Maximum string length is 21. (For PowerShell) 9 | :: Compatible characters: 0-9 Hyphen "-" Period "." Comma "," At "@" A-Z (Caps only) Space " " 10 | :: Requires SETLOCAL EnableDelayedExpansion 11 | ::------------------------------------------------------------------------------- 12 | ::SET "_BANNER_FOUND=YARP" 13 | SET "_BANNER_FOUND=NOPE" 14 | SET "_ORIG_DIR=%CD%" 15 | SET "_ORIG_DIR=%~dp0" 16 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 | :: Just the command 18 | SET "_BANNER_FUNC=Banner.cmd" 19 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 20 | :: Relative locations: 21 | :: Same directory 22 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 23 | SET "_BANNER_FUNC=%CD%\Banner.cmd" 24 | ) 25 | :: One directory down, into functions folder 26 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 27 | SET "_BANNER_FUNC=%CD%\functions\Banner.cmd" 28 | ) 29 | :: One directory down, into Banner folder 30 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 31 | SET "_BANNER_FUNC=%CD%\Banner\Banner.cmd" 32 | ) 33 | :: One directory up 34 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 35 | CD .. 36 | SET "_BANNER_FUNC=!CD!\Banner.cmd" 37 | CD %_ORIG_DIR% 38 | ) 39 | :: One directory up, into functions folder 40 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 41 | CD .. 42 | SET "_BANNER_FUNC=!CD!\functions\Banner.cmd" 43 | CD %_ORIG_DIR% 44 | ) 45 | :: Two directories up 46 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 47 | CD .. 48 | CD .. 49 | SET "_BANNER_FUNC=!CD!\Banner.cmd" 50 | CD %_ORIG_DIR% 51 | ) 52 | :: SodaLake Flash Drive relative path 53 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 54 | CD .. 55 | SET "_BANNER_FUNC=!CD!\Banner\Banner.cmd" 56 | CD %_ORIG_DIR% 57 | ) 58 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 59 | CD .. 60 | CD .. 61 | SET "_BANNER_FUNC=!CD!\Batch\Banner\Banner.cmd" 62 | CD %_ORIG_DIR% 63 | ) 64 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 65 | :: Hard-coded locations: 66 | :: SpiderOak Hive location 67 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 68 | REM SET "_BANNER_FUNC=%USERPROFILE%\Documents\__\Banner\Banner.cmd" 69 | SET "_BANNER_FUNC=%USERPROFILE%\Documents\SpiderOak Hive\Programming\Batch\+Function Library\Banner\Banner.cmd" 70 | ) 71 | :: GitHub location 72 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 73 | REM SET "_BANNER_FUNC=%USERPROFILE%\Documents\__\Banner\Banner.cmd" 74 | SET "_BANNER_FUNC=%USERPROFILE%\Documents\GitHub\Batch-Tools-SysAdmin\functions\Banner.cmd" 75 | ) 76 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 77 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 78 | SET "_BANNER_FOUND=NOPE" 79 | ECHO: 80 | ECHO EXTERNAL FUNCTION NOT FOUND 81 | ECHO ------------------------------------------------------------------------------- 82 | ECHO ERROR: Cannot find Banner.cmd 83 | ECHO %_BANNER_FUNC% 84 | ECHO: 85 | ECHO https://ss64.com/nt/syntax-banner.html 86 | ECHO ------------------------------------------------------------------------------- 87 | ECHO: 88 | PAUSE 89 | ECHO: 90 | REM GOTO END 91 | GOTO SkipBannerFunc 92 | ) ELSE ( 93 | SET "_BANNER_FOUND=YARP" 94 | ) 95 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 96 | :: Script name & extention 97 | FOR %%G IN ("%_BANNER_FUNC%") DO SET "_BANNER_FUNC_NAME=%%~nxG" 98 | 99 | :: Script drive & path 100 | FOR %%G IN ("%_BANNER_FUNC%") DO SET "_BANNER_FUNC_PATH=%%~dpG" 101 | :SkipBannerFunc 102 | :------------------------------------------------------------------------------- 103 | -------------------------------------------------------------------------------- /PowerShell/comp2.bat: -------------------------------------------------------------------------------- 1 | 2 | ::Banner.cmd 3 | :------------------------------------------------------------------------------- 4 | ::CALL "%_BANNER_FUNC%" 12345678901234 5 | ::CALL "%_BANNER_FUNC%" 123456789012345678901 6 | ::CALL "%_BANNER_FUNC%" A-Z, 0-9, . @ 7 | :: Maximum string length is 14. (For CMD) 8 | :: Maximum string length is 21. (For PowerShell) 9 | :: Compatible characters: 0-9 Hyphen "-" Period "." Comma "," At "@" A-Z (Caps only) Space " " 10 | :: Requires SETLOCAL EnableDelayedExpansion 11 | ::------------------------------------------------------------------------------- 12 | ::SET "_BANNER_FOUND=YARP" 13 | SET "_BANNER_FOUND=NOPE" 14 | SET "_ORIG_DIR=%CD%" 15 | SET "_ORIG_DIR=%~dp0" 16 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 | :: Just the command 18 | SET "_BANNER_FUNC=Banner.cmd" 19 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 20 | :: Relative locations: 21 | :: Same directory 22 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 23 | SET "_BANNER_FUNC=%CD%\Banner.cmd" 24 | ) 25 | :: One directory down, into functions folder 26 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 27 | SET "_BANNER_FUNC=%CD%\functions\Banner.cmd" 28 | ) 29 | :: One directory down, into Banner folder 30 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 31 | SET "_BANNER_FUNC=%CD%\Banner\Banner.cmd" 32 | ) 33 | :: One directory up 34 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 35 | CD .. 36 | SET "_BANNER_FUNC=!CD!\Banner.cmd" 37 | CD %_ORIG_DIR% 38 | ) 39 | :: One directory up, into functions folder 40 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 41 | CD .. 42 | SET "_BANNER_FUNC=!CD!\functions\Banner.cmd" 43 | CD %_ORIG_DIR% 44 | ) 45 | :: Two directories up 46 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 47 | CD .. 48 | CD .. 49 | SET "_BANNER_FUNC=!CD!\Banner.cmd" 50 | CD %_ORIG_DIR% 51 | ) 52 | :: SodaLake Flash Drive relative path 53 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 54 | CD .. 55 | SET "_BANNER_FUNC=!CD!\Banner\Banner.cmd" 56 | CD %_ORIG_DIR% 57 | ) 58 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 59 | CD .. 60 | CD .. 61 | SET "_BANNER_FUNC=!CD!\Batch\Banner\Banner.cmd" 62 | CD %_ORIG_DIR% 63 | ) 64 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 65 | :: Hard-coded locations: 66 | :: SpiderOak Hive location 67 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 68 | REM SET "_BANNER_FUNC=%USERPROFILE%\Documents\__\Banner\Banner.cmd" 69 | SET "_BANNER_FUNC=%USERPROFILE%\Documents\SpiderOak Hive\Programming\Batch\+Function Library\Banner\Banner.cmd" 70 | ) 71 | :: GitHub location 72 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 73 | REM SET "_BANNER_FUNC=%USERPROFILE%\Documents\__\Banner\Banner.cmd" 74 | SET "_BANNER_FUNC=%USERPROFILE%\Documents\GitHub\Batch-Tools-SysAdmin\functions\Banner.cmd" 75 | ) 76 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 77 | IF /I NOT EXIST "%_BANNER_FUNC%" ( 78 | SET "_BANNER_FOUND=NOPE" 79 | ECHO: 80 | ECHO EXTERNAL FUNCTION NOT FOUND 81 | ECHO ------------------------------------------------------------------------------- 82 | ECHO ERROR: Cannot find Banner.cmd 83 | ECHO %_BANNER_FUNC% 84 | ECHO: 85 | ECHO https://ss64.com/nt/syntax-banner.html 86 | ECHO ------------------------------------------------------------------------------- 87 | ECHO: 88 | PAUSE 89 | ECHO: 90 | REM GOTO END 91 | GOTO SkipBannerFunc 92 | ) ELSE ( 93 | SET "_BANNER_FOUND=YARP" 94 | ) 95 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 96 | :: Script name & extention 97 | FOR %%G IN ("%_BANNER_FUNC%") DO SET "_BANNER_FUNC_NAME=%%~nxG" 98 | 99 | :: Script drive & path 100 | FOR %%G IN ("%_BANNER_FUNC%") DO SET "_BANNER_FUNC_PATH=%%~dpG" 101 | :SkipBannerFunc 102 | :------------------------------------------------------------------------------- 103 | -------------------------------------------------------------------------------- /Backup and Restore/Data-Rescue-Legacy-Systems.md: -------------------------------------------------------------------------------- 1 | 2 | *This document applies to Windows 2000/NT and above* 3 | 4 | # Company-essential Data Rescue and Backup from Legacy Systems 5 | 6 | There are 3 options when it comes to ensuring business critical data remains intact during a proceedure to either backup data from a legacy machine, or migrate that data into a modern system. The 3 different options are as follows: 7 | 8 | - **Backup important files and data to an external hard drive.** 9 | - **Image the entire drive to an external disk for migration to a modern system.** 10 | - **Salvage the old PC, and image the entire disk to a backup drive to be used in a modern system.** 11 | 12 | These options are listed from highest risk and lowest cost, to lowest risk/highest cost. The decision of which to use depends of the importance of the data to be saved (Useful, Important, Essential, or Mission-Critical) and the budget range available, a decision best left up to the supervisor of the project. 13 | 14 | Due to the inherit risk of years-old mechanical magnetic storage subsystems and aging electrical hardware, all 3 options include a cooldown/cleanup period before any operation is started. This increases the stability of the system and reduces the risk of a failed operation. This process includes: 15 | 16 | - **Two-hour cooldown period for all hardware and power supplies** 17 | - **Case opening/disassembly (if applicable) to vent dust and dirt particles** 18 | - **Dry-air dusting to remove as many particulates as possible** 19 | 20 | ## 1. Backup important files and data to an external hard drive. 21 | 22 | *Risk of failure:* High 23 | 24 | *Cost:* Low 25 | 26 | *Necessary Equipment:* 27 | 28 | - External Hard Drive (with 1.5x necessary storage space) = ~$85 29 | 30 | *Procedure:* 31 | 32 | 1. **Cooldown and cleanout period (as listed above).** 33 | 2. **Identify list of all important files.** 34 | > Because this operation does not image the entire hard drive, the owner and operators of the machine must be present to identify and list out which files and directories contain important information to back up. 35 | 3. **Attach, format, and verify External Drive stability.** 36 | 4. **Copy Operation:** 37 | - *Option A:* **Multi-Threaded File Copy:** *RichCopy 4.0 Microsoft* 38 | - *Option B:* **Restartable/Repeatable File Copy:** *PowerShell / RoboCopy / RoboMirror* 39 | 5. **Verify Data Integrity (optional):** *checksum / hashes* 40 | 41 | 42 | ## 2. Image the entire drive to an external disk for migration into a modern system. 43 | 44 | *Risk of failure:* High 45 | 46 | *Cost:* High 47 | 48 | *Necessary Equipment:* 49 | 50 | - External Hard Drive (with 1.5x necessary storage space) = ~$85 51 | - Modern PC to Migrate data to (Windows or Linux) = $450-$300 52 | 53 | *Procedure:* 54 | 55 | 1. **Cooldown and cleanout period (as listed above).** 56 | 2. **Attach, format, and verify External Drive stability.** 57 | 3. **Drive Image Operation:** 58 | - *Option A:* **Full Drive Image (P2V):** *Disk to VHD Microsoft* 59 | - *Option B:* **Multi-Threaded File Copy:** *RichCopy 4.0 Microsoft* \* 60 | - *Option C:* **Restartable/Repeatable File Copy:** *PowerShell / RoboCopy / RoboMirror* \* 61 | 4. **Verify Data Integrity (optional):** *checksum / hashes / bootable VM* 62 | 63 | 64 | **\* =** Options B and C will not produce a bootable external disk. 65 | 66 | ## 3. Salvage the old PC, and image the entire disk to a backup drive to be used in a modern system. 67 | 68 | *Risk of failure:* Low 69 | 70 | *Cost:* High 71 | 72 | *Necessary Equipment:* 73 | 74 | - External Hard Drive (with 1.5x necessary storage space) = ~$85 75 | - Modern PC to Migrate data to (Windows or Linux) = $450-$300 76 | 77 | *Procedure:* 78 | 79 | 1. **Remove hard disk from legacy PC.** 80 | 2. **Cooldown and cleanout old hard drive.** 81 | 3. **Connect disk to replacement PC and store in a static-free environment with good ventilation and away from high-traffic areas.** 82 | 4. **Attach, format, and verify External Drive stability.** 83 | 5. **Drive Image Operation:** 84 | - *Option A:* **Full Drive Image (P2V):** *Disk to VHD Microsoft* 85 | - *Option B:* **Multi-Threaded File Copy:** *RichCopy 4.0 Microsoft* 86 | - *Option C:* **Restartable/Repeatable File Copy:** *PowerShell / RoboCopy / RoboMirror* 87 | 6. **Verify Data Integrity (optional):** *checksum / hashes* 88 | 89 | #### End of document ### 90 | 91 | *Author: Kerbalnut* 92 | 93 | *Last Updated: 2016-06-16* 94 | 95 | 96 | -------------------------------------------------------------------------------- /NTP-AD.txt: -------------------------------------------------------------------------------- 1 | Thanks to: 2 | http://luka.manojlovic.net/2011/06/24/windows-server-2008-2008-r2-ad-sync-with-external-ntp-server/ 3 | 4 | Time Servers: 5 | http://www.pool.ntp.org/en/ 6 | 0.pool.ntp.org 7 | 0.us.pool.ntp.org 8 | 1.us.pool.ntp.org 9 | 2.us.pool.ntp.org 10 | 3.us.pool.ntp.org 11 | 12 | 13 | Check difference between your server and external time source: 14 | Command: 15 | w32tm /stripchart /computer:0.us.pool.ntp.org /samples:5 /dataonly 16 | 17 | Example: 18 | C:\>w32tm /stripchart /computer:si.pool.ntp.org /samples:5 /dataonly 19 | Tracking si.pool.ntp.org [194.249.198.37:123]. 20 | Collecting 5 samples. 21 | The current time is 24.6.2011 13:29:08. 22 | 13:29:08, +08.8351541s 23 | 13:29:10, +08.7976694s 24 | 13:29:12, +08.8065559s 25 | 13:29:14, +08.7534768s 26 | 13:29:16, +08.7956427s 27 | 28 | 29 | set NTP servers to sync with: 30 | Commands: 31 | w32tm /config /manualpeerlist:si.pool.ntp.org,0x8, /syncfromflags:manual /update 32 | 33 | 34 | Run the following command on the PDC emulator: 35 | >w32tm /config /syncfromflags:manual /manualpeerlist:"0.us.pool.ntp.org 1.us.pool.ntp.org 2.us.pool.ntp.org 3.us.pool.ntp.org" /reliable:yes /update 36 | Once done, restart W32Time service. 37 | 38 | Run the following command on all other DCs (that are not PDC): 39 | >w32tm /config /syncfromflags:domhier /update 40 | Once done, restart W32Time service. 41 | 42 | Restart the W32Time service: 43 | Restart-Service W32Time 44 | net stop w32time & net start w32time 45 | 46 | It's Simple: 47 | http://blogs.technet.com/b/nepapfe/archive/2013/03/01/it-s-simple-time-configuration-in-active-directory.aspx 48 | 49 | Force sync immediately: 50 | Command: 51 | w32tm /resync 52 | 53 | Example: 54 | >w32tm /resync 55 | Sending resync command to local computer 56 | The computer did not resync because the required time change was too big. 57 | >w32tm /resync /force 58 | 59 | 60 | Error: 61 | This server's clock is not synchronized with the primary domain controller's clock. 62 | 63 | To check the current time source 64 | Windows XP - 65 | >Net time /QUERYSNTP 66 | Windows 7 or later - 67 | >w32tm /query /source 68 | To view The complete Configuration Of windows Time service on any computer run the below command 69 | >w32tm /query /configuration 70 | 71 | 72 | Correct the system time according to domain controller 73 | This command will check the local system time with corresponding domain controller. 74 | >net time \\SharePointServ.martekservers.com /set 75 | >NET TIME /domain:martekservers.com /SET /Y 76 | 77 | To configure a client computer for automatic domain time synchronization 78 | w32tm /config /syncfromflags:domhier /update 79 | 80 | 81 | 82 | 83 | Contents of Sync-withTimeServers.bat: 84 | :: w32tm /stripchart /computer:0.us.pool.ntp.org /samples:5 /dataonly 85 | :: w32tm /config /syncfromflags:manual /manualpeerlist:"0.us.pool.ntp.org 1.us.pool.ntp.org 2.us.pool.ntp.org 3.us.pool.ntp.org" /update 86 | w32tm /resync 87 | :: w32tm /resync /force 88 | 89 | Run this on old 2003 servers that used to be PDC at one time but now still think that they are: 90 | w32tm /config /syncfromflags:domhier /reliable:no /update 91 | 92 | 93 | 94 | 95 | 96 | Server Fault: 97 | http://serverfault.com/questions/486593/hyper-v-time-sync-for-vm-domain-controller 98 | 99 | >reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\VMICTimeProvider /v Enabled /t reg_dword /d 0 100 | 101 | 102 | Run this on PDC: 103 | w32tm /config /manualpeerlist:"0.pool.ntp.org,0x1" /syncfromflags:MANUAL /reliable:yes 104 | w32tm /config /update 105 | w32tm /resync w32tm /resync /rediscover 106 | 107 | 108 | 109 | ******** early exit, above solutions already worked. 110 | 111 | This server's clock is not synchronized with the primary domain controller's clock. 112 | 113 | To check the current time source 114 | Windows XP - 115 | >Net time /QUERYSNTP 116 | Windows 7 or later - 117 | >w32tm /query /source 118 | To view The complete Configuration Of windows Time service on any computer run the below command 119 | >w32tm /query /configuration 120 | 121 | 122 | Correct the system time according to domain controller 123 | This command will check the local system time with corresponding domain controller. 124 | >net time \\SharePointServ.martekservers.com /set 125 | >NET TIME /domain:martekservers.com /SET /Y 126 | 127 | To configure a client computer for automatic domain time synchronization 128 | w32tm /config /syncfromflags:domhier /update 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /Linux/LogCleanup.sh: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------------------------------------- 2 | # Information & Description: 3 | 4 | # Clean-up log file for: 5 | # /home/pi/DynDNS/DynDNS-NameSilo-RottenEggs.py 6 | # e.g. 7 | # /home/pi/DynDNS/DynDNS-NameSilo-RottenEggs.log 8 | 9 | # /Information & Description 10 | # -------------------------------------------------------------------------------------------------------- 11 | # Setup & Instructions: 12 | 13 | # To copy this script to Raspberry Pi via PuTTY: 14 | #pscp "%UserProfile%\Documents\Flash Drive updates\Pi-Hole DNS server\DynDNS-NameSilo-RottenEggs-LogCleanup.sh" pi@my.pi:/home/pi/DynDNS/DynDNS-NameSilo-RottenEggs-LogCleanup.sh 15 | 16 | # Make script executable: 17 | # Note that to make a file executable, you must set the eXecutable bit, and for a shell script, the Readable bit must also be set: 18 | #cd /home/pi/DynDNS/ 19 | #ls -l 20 | #chmod a+rx DynDNS-NameSilo-RottenEggs-LogCleanup.sh 21 | #ls -l 22 | 23 | # Permissions breakdown: 24 | # drwxrwxrwx 25 | # | | | | 26 | # | | | others 27 | # | | group 28 | # | user 29 | # is directory? 30 | 31 | # u = owner of the file (user) 32 | # g = groups owner (group) 33 | # o = anyone else on the system (other) 34 | # a = all 35 | 36 | # + = add permission 37 | # - = remove permission 38 | 39 | # r = read permission 40 | # w = write permission 41 | # x = execute permission 42 | 43 | # To run this script: 44 | #/home/pi/DynDNS/DynDNS-NameSilo-RottenEggs-LogCleanup.sh 45 | #cd /home/pi/DynDNS/ 46 | #./DynDNS-NameSilo-RottenEggs-LogCleanup.sh 47 | 48 | # Schedule script to run automatically once every 2 weeks: 49 | #crontab -l 50 | #crontab -e 51 | #0 0 */14 * * /home/pi/DynDNS/DynDNS-NameSilo-RottenEggs-LogCleanup.sh 52 | #crontab -l 53 | 54 | # Schedule script to run automatically once every month: 55 | #crontab -l 56 | #crontab -e 57 | #0 0 1 */1 * /home/pi/DynDNS/DynDNS-NameSilo-RottenEggs-LogCleanup.sh 58 | #crontab -l 59 | 60 | # m h dom mon dow command 61 | 62 | # * * * * * command to execute 63 | # - - - - - 64 | # ¦ ¦ ¦ ¦ ¦ 65 | # ¦ ¦ ¦ ¦ ¦ 66 | # ¦ ¦ ¦ ¦ +----- day of week (0 - 7) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0) 67 | # ¦ ¦ ¦ +---------- month (1 - 12) 68 | # ¦ ¦ +--------------- day of month (1 - 31) 69 | # ¦ +-------------------- hour (0 - 23) 70 | # +------------------------- min (0 - 59) 71 | 72 | # /Setup & Instructions 73 | # -------------------------------------------------------------------------------------------------------- 74 | # Parameters: 75 | 76 | CURRENT_LOGFILE_PATH="/home/pi/DynDNS/DynDNS-NameSilo-RottenEggs.log" 77 | 78 | #ARCHIVE_LOGFILE_PATH="/home/pi/DynDNS/DynDNS-NameSilo-RottenEggs-LastTwoWeeks.log" 79 | ARCHIVE_LOGFILE_PATH="/home/pi/DynDNS/DynDNS-NameSilo-RottenEggs-LastMonth.log" 80 | 81 | # /Parameters 82 | # -------------------------------------------------------------------------------------------------------- 83 | # Main: 84 | 85 | # https://www.shellscript.sh/ 86 | 87 | # Delete archive log file: 88 | echo "Deleting archive log file (if exists):" 89 | echo $ARCHIVE_LOGFILE_PATH 90 | if [ -f $ARCHIVE_LOGFILE_PATH ]; then 91 | # File exists. 92 | echo "Deleting file..." 93 | rm $ARCHIVE_LOGFILE_PATH 94 | else 95 | # File does not exist. 96 | echo "File does not exist." 97 | fi 98 | 99 | # Copy current log file to archive position: 100 | echo $'\n'"Copying current log file to archive position:" 101 | echo current: $CURRENT_LOGFILE_PATH 102 | echo archive: $ARCHIVE_LOGFILE_PATH 103 | cp $CURRENT_LOGFILE_PATH $ARCHIVE_LOGFILE_PATH 104 | 105 | # Append footer message to archive log file: 106 | echo $'\n'"Wrapping-up archive log file:" 107 | #CURRENT_TIMESTAMP=`date --iso-8601=ns` 108 | CURRENT_TIMESTAMP=`date --rfc-3339=seconds` 109 | echo "Current date/time: $CURRENT_TIMESTAMP" 110 | echo "--------------------------------------------------------------------------------" >> $ARCHIVE_LOGFILE_PATH 111 | echo $'\n' >> $ARCHIVE_LOGFILE_PATH 112 | echo "--------------------------------------------------------------------------------" >> $ARCHIVE_LOGFILE_PATH 113 | echo "Archived:" $CURRENT_TIMESTAMP $'\n' >> $ARCHIVE_LOGFILE_PATH 114 | echo $'\n' >> $ARCHIVE_LOGFILE_PATH 115 | 116 | # Delete current log file: 117 | echo $'\n'"Deleting current log file:" 118 | echo $CURRENT_LOGFILE_PATH 119 | rm $CURRENT_LOGFILE_PATH 120 | 121 | # /Main 122 | # -------------------------------------------------------------------------------------------------------- 123 | # Footer: 124 | 125 | echo "End of script." 126 | 127 | # /Footer 128 | # -------------------------------------------------------------------------------------------------------- 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /Wireshark/wireshark_filters.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Resolve IP addresses: 4 | ------------------------------------------------------------------------------- 5 | https://osqa-ask.wireshark.org/questions/37680/can-wireshark-automatically-resolve-the-ip-address-into-host-names 6 | 7 | Edit -> Preferences -> Name Resolution 8 | 9 | You can also 'Use an external name resolver' to resolve the IP addresses using your DNS when you open the trace file. 10 | 11 | 12 | Sort by conversations: 13 | ------------------------------------------------------------------------------- 14 | https://osqa-ask.wireshark.org/questions/4164/building-display-filter-using-conversations 15 | 16 | Simplify your filter to "tcp.flags == 0x02". This will show you the initial SYN of each conversation. (TCP 3-way Handshake. SYN,SYN-ACK,ACK) 17 | 18 | tcp.flags == 0x02 19 | 20 | 21 | Logical expressions: 22 | ------------------------------------------------------------------------------- 23 | https://www.wireshark.org/docs/man-pages/wireshark-filter.html 24 | 25 | Tests can be combined using logical expressions. These too are expressible in C-like syntax or with English-like abbreviations: 26 | and, && Logical AND 27 | or, || Logical OR 28 | not, ! Logical NOT 29 | 30 | Expressions can be grouped by parentheses as well. The following are all valid display filter expressions: 31 | tcp.port == 80 and ip.src == 192.168.2.1 32 | not llc 33 | http and frame[100-199] contains "wireshark" 34 | (ipx.src.net == 0xbad && ipx.src.node == 0.0.0.0.0.1) || ip 35 | 36 | 37 | 38 | Filter certain conversations: 39 | ------------------------------------------------------------------------------- 40 | https://null-byte.wonderhowto.com/news/8-wireshark-filters-every-wiretapper-uses-spy-web-conversations-and-surfing-habits-0134508/ 41 | 42 | ip.addr ==x.x.x.x && ip.addr ==x.x.x.x 43 | 44 | Sets a conversation filter between the two IP addresses. 45 | 46 | 47 | https://thetechl33t.com/2015/06/01/wireshark-not-equal-to-filter/ 48 | 49 | To filter out a certain IP address, the !- statment is deprecated. Instead use this: 50 | 51 | !ip.addr == 192.168.0.1 52 | 53 | To filter out multiple IP addresses, use: 54 | 55 | !ip.addr == 192.168.0.1 && !ip.addr == pi.hole 56 | !ip.addr == 192.168.0.1 && !ip.host == pi.hole 57 | 58 | 59 | https://osqa-ask.wireshark.org/questions/22230/filter-for-partial-ip-address 60 | 61 | To filter for public hostnames, use: 62 | 63 | ip.host contains netflix 64 | ip.host contains netflix || ip.host contains nflxext.com 65 | 66 | 67 | Search by packet Info: 68 | ------------------------------------------------------------------------------- 69 | https://networksecuritytools.com/list-wireshark-display-filters/ 70 | 71 | 15. Filter on three way handshake 72 | 73 | The three way handshake is often used to calculate the network round trip time. This filter will display all the SYN, SYN ACK and SYN packets that should match the three way handshake. 74 | 75 | tcp.flags.syn==1 or (tcp.seq==1 and tcp.ack==1 and tcp.len==0 and tcp.analysis.initial_rtt) 76 | 77 | 16. Find executable or other file types 78 | 79 | Need to see if users are download .exe or other file types use this filter: 80 | 81 | frame contains "(attachment|tar|exe|zip|pdf)" 82 | 83 | Just add in any other file extension you want to filter for. 84 | 85 | 17. Search traffic based on a keyword: 86 | 87 | tcp contains facebook 88 | 89 | This displays all TCP packets that contain the word facebook. Just replace the word with want you want to search for. The only problem with this filter is it’s limited to TCP packets only. To include all protocols use this filter: 90 | 91 | frame contains facebook 92 | 93 | Case Sensitivity: 94 | ------------------------------------------------------------------------------- 95 | https://www.wireshark.org/docs/man-pages/wireshark-filter.html 96 | 97 | contains Does the protocol, field or slice contain a value 98 | matches, ~ Does the protocol or text string match the given 99 | case-insensitive Perl-compatible regular expression 100 | 101 | Matches are case-insensitive by default. For example, to search for a given WAP WSP User-Agent, you can write: 102 | 103 | wsp.user_agent matches "cldc" 104 | 105 | This would match "cldc", "CLDC", "cLdC" or any other combination of upper and lower case letters. 106 | 107 | 108 | 109 | Wireshark can only decrypt RSA, and only if the private key is known: 110 | ------------------------------------------------------------------------------- 111 | https://blog.packet-foo.com/2016/07/how-to-use-wireshark-to-steal-passwords/ 112 | 113 | Other reading: 114 | https://www.comparitech.com/net-admin/decrypt-ssl-with-wireshark/#Wireshark_makes_decrypting_SSL_traffic_easy 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /Remote Access/SysInternals/ReadMe.md: -------------------------------------------------------------------------------- 1 | 2 | # Sysinternals Notes 3 | 4 | ### Psexec notes 5 | 6 | `-d` Don't wait for process to terminate, non-interactive 7 | 8 | `-u [\]` 9 | 10 | `-p ` 11 | 12 | `-i ` Use `tasklist` command to get session number to interact with 13 | 14 | `-accepteula` This flag suppresses the display of the license dialog. 15 | 16 | `-h` If the target system is Vista or higher, has the process run with the account's elevated token, if available. 17 | 18 | `-c` Copy the specified program to the remote system for execution. If you omit this option the application must be in the system path on the remote system. 19 | 20 | ### Extra SysInternals commands: 21 | 22 | http://www.howtogeek.com/school/sysinternals-pro/lesson8/all/ 23 | 24 | --- 25 | 26 | # Running commands through an interactive shell on a remote machine 27 | 28 | `psinfo \\HOSTNAME` Get info on remote system 29 | 30 | `psexec \\HOSTNAME tasklist` Use the `tasklist` tool to get Session Name and Session# in a list of processes running on the remote machine. 31 | 32 | Session Name: 33 | 34 | - Services = SYSTEM-run background processes 35 | - Console = Physical screen terminal user 36 | - RDP-Tcp#0 = Remote desktop users 37 | 38 | Session# = value for `psexec -i` for where you want process to start: 39 | 40 | - Services = 0 *(not recommended to mess around with the system's session)* 41 | - Console = 1 42 | - etc. 43 | 44 | `psexec \\HOSTNAME ipconfig /all` Display networking information about the remote system 45 | 46 | `psexec \\HOSTNAME cmd.exe` Enter a interactive command prompt with remote machine. 47 | 48 | `psexec \\HOSTNAME -u domain\johndoe -p ******** cmd.exe` Enter a interactive command prompt with remote machine using alternate credentials 49 | 50 | --- 51 | 52 | **Commands to run once connected to remote interactive command prompt:** 53 | 54 | `hostname` Verify you're executing commands from the remote machine. 55 | 56 | `nslookup myip.opendns.com. resolver1.opendns.com` Retrieve public IP address, useful if connecting to a remote site through VPN tunnel. 57 | 58 | `mkdir "C:\Users\janedoe\Desktop\Hikvision Plugin"` Create folder on remote machine. 59 | 60 | `xcopy \\SERVER_NAME\Applications\USSCWebComponents.exe "C:\Users\janedoe\Desktop\Hikvision Plugin"` Copy file from a remote machine accessible on the network to the newly created folder. 61 | 62 | `xcopy \\SERVER_NAME\Applications\USSCWebComponents(1).exe "C:\Users\janedoe\Desktop\Hikvision Plugin"` Copy second file from a remote machine accessible on the network to the newly created folder. 63 | 64 | `xcopy \\SERVER_NAME\Applications\USSCWebComponents*.exe "C:\Users\janedoe\Desktop\Hikvision Plugin"` Alternatively, xcopy supports wildcards `*` so instead of the two above commands, you could use this one command. 65 | 66 | `dir "C:\Users\janedoe\Desktop\Hikvision Plugin"` Verify that the files were written to the folder. 67 | 68 | `systeminfo | find "System Boot Time:"` Get system up-time 69 | 70 | `exit` Exit interactive shell 71 | 72 | --- 73 | 74 | **Commands to run once you've disconnected:** 75 | 76 | `psexec \\HOSTNAME -d -i 1 -accepteula -h -u domain\johndoe -p ******** "C:\Users\janedoe\Desktop\Hikvision Plugin\USSCWebComponents.exe"` Execute the newly copied program on the remote machine with Elevated permissions (`-h`), in the user's desktop session (`-i 1`) and do not wait for command to complete before resuming our command line (`-d`) 77 | 78 | --- 79 | 80 | # Get users logged-in to the remote machine 81 | 82 | `-c` Copy the specified program to the remote system for execution. If you omit this option the application must be in the system path on the remote system. 83 | 84 | `psexec \\HOSTNAME -c %ChocolateyInstall%\lib\sysinternals\tools\logonsessions.exe -accepteula` 85 | 86 | `psexec \\HOSTNAME -c logonsessions.exe -accepteula` 87 | 88 | --- 89 | 90 | `WMIC /NODE: "workstation_name" COMPUTERSYSTEM GET USERNAME` Get username currently logged into "workstation_name" 91 | 92 | --- 93 | 94 | `psloggedon.exe -l` Get users logged-on to the local machine. 95 | 96 | `psloggedon.exe \\HOSTNAME` Get users logged-on to remote machine. 97 | 98 | --- 99 | 100 | `psexec \\HOSTNAME tasklist` 101 | 102 | --- 103 | 104 | # Other commands 105 | 106 | `psexec \\HOSTNAME -d -i 2 -accepteula -u domain\johndoe -p ******** winver` Get Windows version of remote machine. Weird error: this command requires username and password, otherwise window will open but content won't load. 107 | 108 | --- 109 | 110 | # PowerShell & Remoting 111 | 112 | ## Get PowerShell version on remote machine: 113 | 114 | `psexec \\HOSTNAME -accepteula powershell.exe -NoProfile -Command $PSVersionTable.PSVersion` 115 | 116 | `psexec \\HOSTNAME -accepteula -h -u domain\johndoe powershell.exe -NoProfile -Command $PSVersionTable.PSVersion` 117 | 118 | ## Get interactive PowerShell prompt on remote machine: 119 | 120 | `-h` If the target system is Vista or higher, has the process run with the account's elevated token, if available. 121 | 122 | `psexec \\HOSTNAME -d -i 3 -accepteula -u domain\johndoe -p ******** powershell.exe` 123 | 124 | `psexec \\HOSTNAME -d -i 3 -accepteula -h -u domain\johndoe -p ******** powershell.exe` 125 | 126 | -------------------------------------------------------------------------------- /Pull-UpdatesFromGithub.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | SET "_PREV_COMMITS_TO_GET=8" 4 | 5 | SET "_BRANCH=backup-and-restore" 6 | 7 | REM ------------------------------------------------------------------------------- 8 | REM =============================================================================== 9 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 | :Main 11 | 12 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 13 | 14 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 15 | 16 | ::Thanks to: 17 | ::https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History 18 | ECHO: 19 | ECHO Last %_PREV_COMMITS_TO_GET% commits known in the local repository: 20 | ECHO: 21 | 22 | :: Natural command: 23 | ::git log -6 --pretty=format:"%h - %an, %ar : %s" 24 | :: This will work from the command line, but in batch script percentage signs % must be doubled-up to be literal %% 25 | 26 | git log -%_PREV_COMMITS_TO_GET% --pretty=format:"%%h - %%an, %%ar : %%s" 27 | 28 | ECHO: 29 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 30 | 31 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32 | 33 | ::Thanks to: 34 | ::https://stackoverflow.com/questions/180272/how-to-preview-git-pull-without-doing-fetch 35 | 36 | git fetch 37 | 38 | ECHO: 39 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 40 | 41 | ECHO: 42 | ECHO Newly-fetched commits from %_BRANCH%: 43 | ECHO: 44 | 45 | git -P log HEAD..origin/%_BRANCH% 46 | 47 | ECHO: 48 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 49 | 50 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 51 | 52 | ECHO: 53 | ECHO Files changed in my local folder: 54 | ECHO: 55 | 56 | git -P diff --name-status 57 | 58 | ECHO: 59 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 60 | 61 | ECHO: 62 | ECHO Details of local changes: 63 | ECHO: 64 | PAUSE 65 | ECHO: 66 | 67 | git -P diff 68 | 69 | ECHO: 70 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 71 | ECHO: 72 | 73 | :PromptForCommitMsg 74 | SET /P "_COMMIT_MESSAGE=Please enter a message about your changes: " 75 | IF /I "%_COMMIT_MESSAGE%"=="" GOTO PromptForCommitMsg 76 | 77 | ECHO "CMDLINE: %_COMMIT_MESSAGE%" 78 | 79 | PAUSE 80 | 81 | git add . 82 | git commit -m "CMDLINE: %_COMMIT_MESSAGE%" 83 | 84 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 85 | 86 | ECHO: 87 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 88 | ECHO: 89 | ECHO Merge: 90 | ECHO: 91 | PAUSE 92 | ECHO: 93 | 94 | ::file:///C:/Program%20Files/Git/mingw64/share/doc/git-doc/git-merge.html 95 | 96 | git -P merge -m "CMDLINE AUTO-MERGE: %_COMMIT_MESSAGE%" 97 | 98 | ECHO: 99 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 100 | ECHO: 101 | ECHO Conflicting commits: 102 | ECHO: 103 | PAUSE 104 | ECHO: 105 | 106 | git -P log --merge 107 | 108 | ECHO: 109 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 110 | ECHO: 111 | ECHO Conflicting files: 112 | ECHO: 113 | ECHO: 114 | 115 | git -P diff --name-status 116 | 117 | ECHO: 118 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 119 | ECHO: 120 | ECHO Details of file conflicts: 121 | ECHO: 122 | PAUSE 123 | ECHO: 124 | 125 | git -P diff --color-words 126 | 127 | ECHO: 128 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 129 | ECHO: 130 | ECHO Conflicting files ^("%CD%"^): 131 | ECHO: 132 | 133 | git -P diff --name-status 134 | 135 | ECHO: 136 | :: https://ss64.com/nt/choice.html 137 | CHOICE /M "Edit files that are in conflict with a text editor?" 138 | IF ERRORLEVEL 2 GOTO NoEditPrompt & REM No. 139 | IF ERRORLEVEL 1 REM Yes. 140 | :NOCHOICE 141 | EXPLORER "%CD%" 142 | ECHO: 143 | 144 | :RequireConfirmation 145 | SET /P "_CONFIRM_DONE=Edit files that are in conflict with a text editor, then type DONE: " 146 | IF /I NOT "%_CONFIRM_DONE%"=="DONE" GOTO RequireConfirmation 147 | 148 | :NoEditPrompt 149 | 150 | git -P merge --continue 151 | 152 | ECHO: 153 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 154 | ECHO: 155 | ECHO Pull: 156 | ECHO: 157 | PAUSE 158 | ECHO: 159 | 160 | git pull 161 | 162 | ECHO: 163 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 164 | ECHO: 165 | ECHO Push: 166 | ECHO: 167 | PAUSE 168 | ECHO: 169 | 170 | git push 171 | 172 | ECHO: 173 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174 | 175 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176 | 177 | :: End Main 178 | 179 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 180 | REM =============================================================================== 181 | REM ------------------------------------------------------------------------------- 182 | 183 | :Footer 184 | :END 185 | ::ENDLOCAL 186 | ECHO: 187 | ECHO End %~nx0 188 | ECHO: 189 | PAUSE 190 | ::GOTO :EOF 191 | EXIT /B & REM If you call this program from the command line and want it to return to CMD instead of closing Command Prompt, need to use EXIT /B or no EXIT command at all. 192 | -------------------------------------------------------------------------------- /Backup and Restore/Clone-BackupRestoreBranchOnly.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM ------------------------------------------------------------------------------- 4 | 5 | :Parameters 6 | 7 | :: Param1 = Folder location to pull branch to 8 | 9 | SET "_FOLDER_LOCATION=E:\Backup And Restore Tools2" 10 | SET "_FOLDER_LOCATION=E:\testing\demo\test\Backup And Restore Tools2" 11 | SET "_FOLDER_LOCATION=%UserProfile%\Desktop\DEMO\foo\bar" 12 | 13 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 14 | 15 | :: Param2 = GitHub Repo to pull from 16 | 17 | SET "_GITHUB_REPO=https://github.com/Kerbalnut/Batch-Tools-SysAdmin.git" 18 | 19 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 20 | 21 | :: Param3 = Branch to pull 22 | 23 | SET "_BRANCH=backup-and-restore" 24 | 25 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 26 | 27 | :: End Parameters 28 | 29 | REM ------------------------------------------------------------------------------- 30 | 31 | REM ECHO DEBUGGING: Begin ExternalFunctions block. 32 | 33 | :ExternalFunctions 34 | :: Load External functions and programs: 35 | 36 | ::Git 37 | :------------------------------------------------------------------------------- 38 | ::"%_GIT_EXE%" (help function is just the command alone) 39 | ::IF "%_GIT_INSTALLED%"=="YES" "%_GIT_EXE%" 40 | ::------------------------------------------------------------------------------- 41 | :: Parameters 42 | ::GOTO SkipGitFunction 43 | SET "_QUIET_ERRORS=NO" 44 | ::SET "_QUIET_ERRORS=YES" 45 | ::------------------------------------------------------------------------------- 46 | SET "_GIT_INSTALLED=NO" 47 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 48 | :: Check if the just the command succeeds (same as help function in this case). Redirect text output to NULL but redirect error output to temp file. 49 | SET "_ERROR_OUTPUT_FILE=%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.txt" 50 | git --version >nul 2>&1 && SET "_GIT_INSTALLED=YES" & SET "_GIT_EXE=git" & REM ECHO git help command succeeded. & REM git help command returned success. 51 | git --version >nul 2>"%_ERROR_OUTPUT_FILE%" || ( 52 | REM SET "_GIT_INSTALLED=NO" 53 | IF /I NOT "%_QUIET_ERRORS%"=="YES" ( 54 | ECHO git help command failed. & REM git help command failed. 55 | ECHO Error output text: 56 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 57 | TYPE "%_ERROR_OUTPUT_FILE%" 58 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 59 | ECHO: 60 | ) 61 | ) 62 | IF EXIST "%_ERROR_OUTPUT_FILE%" DEL /Q "%_ERROR_OUTPUT_FILE%" & REM Clean-up temp file ASAP. 63 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 64 | :: C:\Program Files\Git\bin\git.exe 65 | IF /I "%_GIT_INSTALLED%"=="NO" SET "_GIT_EXE=%ProgramFiles%\Git\bin\git.exe" 66 | IF /I EXIST "%_GIT_EXE%" SET "_GIT_INSTALLED=YES" 67 | :: C:\ProgramData\chocolatey\lib\putty.portable\tools\Git 68 | IF /I "%_GIT_INSTALLED%"=="NO" SET "_GIT_EXE=%ProgramFiles(x86)%\Git\bin\git.exe" 69 | IF /I EXIST "%_GIT_EXE%" SET "_GIT_INSTALLED=YES" 70 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 71 | IF /I "%_QUIET_ERRORS%"=="NO" ( 72 | IF /I "%_GIT_INSTALLED%"=="NO" ( 73 | ECHO: 74 | ECHO EXTERNAL FUNCTION NOT FOUND 75 | ECHO ------------------------------------------------------------------------------- 76 | ECHO ERROR: Cannot find Git 77 | REM ECHO %_GIT_EXE% 78 | ECHO: 79 | ECHO Chocolatey ^(Run As Administrator^) 80 | ECHO ^> choco install tortoisegit -y 81 | ECHO or 82 | ECHO ^> choco install github-desktop -y 83 | ECHO: 84 | ECHO https://chocolatey.org/packages/TortoiseGit 85 | ECHO: 86 | ECHO https://chocolatey.org/packages/github-desktop 87 | ECHO ------------------------------------------------------------------------------- 88 | ECHO: 89 | PAUSE 90 | ECHO: 91 | GOTO END 92 | ) 93 | ) 94 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 95 | :: Git 96 | :: "%_GIT_EXE%" 97 | :SkipGitFunction 98 | :------------------------------------------------------------------------------- 99 | 100 | ::End ExternalFunctions 101 | 102 | REM ------------------------------------------------------------------------------- 103 | REM =============================================================================== 104 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 105 | :Main 106 | 107 | REM ECHO DEBUGGING: Beginning Main execution block. 108 | 109 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 110 | 111 | :: Create directory if it doesn't exist 112 | 113 | ECHO New pull location = "%_FOLDER_LOCATION%" 114 | ECHO: 115 | ::PAUSE 116 | 117 | IF NOT EXIST "%_FOLDER_LOCATION%" MKDIR "%_FOLDER_LOCATION%" 118 | 119 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 120 | 121 | :: Navigate to directory 122 | 123 | CD /D "%_FOLDER_LOCATION%" 124 | 125 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 126 | 127 | ::Thanks to: 128 | ::https://stackoverflow.com/a/7349740/2449416 129 | 130 | :: To clone a branch without fetching other branches: 131 | 132 | ::git init 133 | ::git remote add -t %_BRANCH% -f origin %_GITHUB_REPO% 134 | ::git checkout %_BRANCH% 135 | 136 | ECHO DEBUGGING: New pull location = "%_FOLDER_LOCATION%" 137 | ECHO DEBUGGING: Current location = "%CD%" 138 | ECHO DEBUGGING: _GIT_EXE = "%_GIT_EXE%" 139 | PAUSE 140 | 141 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 142 | "%_GIT_EXE%" init 143 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 144 | "%_GIT_EXE%" remote add -t %_BRANCH% -f origin %_GITHUB_REPO% 145 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 146 | "%_GIT_EXE%" checkout %_BRANCH% 147 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 148 | 149 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 150 | 151 | :: Open the newly pulled folder 152 | 153 | EXPLORER "%_FOLDER_LOCATION%" 154 | 155 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 156 | 157 | :: End Main 158 | 159 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 160 | REM =============================================================================== 161 | REM ------------------------------------------------------------------------------- 162 | 163 | :Footer 164 | :END 165 | ::ENDLOCAL 166 | ECHO: 167 | ECHO End %~nx0 168 | ECHO: 169 | PAUSE 170 | ::GOTO :EOF 171 | EXIT /B & REM If you call this program from the command line and want it to return to CMD instead of closing Command Prompt, need to use EXIT /B or no EXIT command at all. 172 | 173 | -------------------------------------------------------------------------------- /AutoHotKey/Spam Experts/Browser-Test.ahk: -------------------------------------------------------------------------------- 1 | ; Auto-execute section 2 | 3 | ; 1. Launch IE to example.com/cpanel 4 | 5 | ; 2. Type in username "example.com" and password and click "Submit" 6 | 7 | ; username textfield data from iWB2Learner 8 | ; Title "Account Login - Bluehost" 9 | ; Url "https://my.bluehost.com/cgi/account/cpanel?goto_uri=/" 10 | ; Index 177 11 | ; Name "ldomain" 12 | ; ID "ldomain" 13 | ; Value example.com 14 | ; OuterHTML 15 | 16 | 17 | ; password textfield data from iWB2Learner 18 | ; Title "Account Login - Bluehost" 19 | ; Url "https://my.bluehost.com/cgi/account/cpanel?goto_uri=/" 20 | ; Index 178 21 | ; Name "lpass" 22 | ; ID "lpass" 23 | ; Value ****** 24 | ; OuterHTML 25 | 26 | 27 | ; submit button data from iWB2Learner 28 | ; Title "Account Login - Bluehost" 29 | ; Url "https://my.bluehost.com/cgi/account/cpanel?goto_uri=/" 30 | ; Index 180 31 | ; Name 32 | ; ID 33 | ; Value 34 | ; OuterHTML 35 | 36 | 37 | ; 3. Click on "Spam Experts" button 38 | 39 | ; spam experts text button data from iWB2Learner 40 | ; Title "Bluehost cPanel - example.com" 41 | ; Url "https://box844.bluehost.com:2083/cpsess2759538622/frontend/bluehost/index.html?post_login=96305375834611" 42 | ; Index 399 43 | ; Name 44 | ; ID "item_mail_spamexperts" 45 | ; InnerText "Spam Experts" 46 | ; OuterHTML Spam Experts 47 | 48 | ; spam experts icon button data from iWB2Learner 49 | ; Title "Bluehost cPanel - example.com" 50 | ; Url "https://box844.bluehost.com:2083/cpsess2759538622/frontend/bluehost/index.html?post_login=96305375834611" 51 | ; Index 398 52 | ; Name 53 | ; ID "icon-mail_spamexperts" 54 | ; InnerText 55 | ; OuterHTML 56 | 57 | ; 4. Click "Manage" for example.com/cgi/account/cpanel 58 | 59 | ; manage text button data from iWB2Learner 60 | ; Title "SpamExperts Email Security - example.com" 61 | ; Url "https://my.bluehost.com/cgi/spamexperts" 62 | ; Index 213 63 | ; Name 64 | ; ID 65 | ; InnerText "Manage" 66 | ; OuterHTML Manage 67 | 68 | 69 | ; 5. Click either "Report spam" or "Repot not spam" button 70 | 71 | 72 | ; report spam text button data from iWB2Learner 73 | ; Title "Dashboard" 74 | ; Url "https://spamlogin.com/dashboard.php" 75 | ; Index 243 76 | ; Name 77 | ; ID 78 | ; InnerText "Report spam" 79 | ; OuterHTML Report spam 80 | 81 | 82 | ; report spam icon button data from iWB2Learner 83 | ; Title "Dashboard" 84 | ; Url "https://spamlogin.com/dashboard.php" 85 | ; Index 242 86 | ; Name 87 | ; ID 88 | ; InnerText 89 | ; OuterHTML
90 | 91 | 92 | 93 | 94 | ; report not spam text button data from iWB2Learner 95 | ; Title "Dashboard" 96 | ; Url "https://spamlogin.com/dashboard.php" 97 | ; Index 248 98 | ; Name 99 | ; ID 100 | ; InnerText "Report not spam" 101 | ; OuterHTML Report not spam 102 | 103 | 104 | ; report not spam icon button data from iWB2Learner 105 | ; Title "Dashboard" 106 | ; Url "https://spamlogin.com/dashboard.php" 107 | ; Index 247 108 | ; Name 109 | ; ID 110 | ; InnerText 111 | ; OuterHTML
112 | 113 | 114 | 115 | ; 6. Upload .eml or .msg files to report as "is" or "is not" spam 116 | 117 | ; report spam page 118 | ; browse for file button data from iWB2Learner 119 | ; Title "Report spam (example.com)" 120 | ; Url "https://spamlogin.com/reportspam.php" 121 | ; Index 196 122 | ; Name 123 | ; ID 124 | ; InnerText "Browse" 125 | ; OuterHTML  Browse 126 | 127 | 128 | ; report not spam page 129 | ; browse for file button data from iWB2Learner 130 | ; Title "Report not spam (example.com)" 131 | ; Url "https://spamlogin.com/reportnotspam.php" 132 | ; Index 196 133 | ; Name 134 | ; ID 135 | ; InnerText "Browse" 136 | ; OuterHTML  Browse 137 | 138 | ; paste full path of file to upload into browse window 139 | 140 | ; accept file = send "Enter" key from keyboard / "Tab" to Open button and send "Enter" 141 | 142 | ; report spam page 143 | ; upload button data from iWB2Learner 144 | ; Title "Report spam (example.com)" 145 | ; Url "https://spamlogin.com/reportspam.php" 146 | ; Index 202 147 | ; Name 148 | ; ID 149 | ; InnerText "Browse" 150 | ; OuterHTML 151 | 152 | ; report not spam page 153 | ; upload button data from iWB2Learner 154 | ; Title "Report not spam (example.com)" 155 | ; Url "https://spamlogin.com/reportnotspam.php" 156 | ; Index 202 157 | ; Name 158 | ; ID 159 | ; InnerText "Browse" 160 | ; OuterHTML 161 | 162 | ; 7. Close web browser 163 | 164 | ; 8. Send email back to sender to let them know if operation completed or not. 165 | 166 | ; 167 | 168 | ; End script 169 | 170 | 171 | -------------------------------------------------------------------------------- /functions/ping-wait.cmd: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ::SET "_WAIT_SECONDS=%~1" 3 | ::IF "%~1"=="" SET "_WAIT_SECONDS=2" & REM Time in seconds, defaults to 2 4 | ::SET /A "_TARGET=%_WAIT_SECONDS%*80" 5 | SET "_TARGET=12" 6 | SET /A "_TARGET+=1" 7 | SET "_START_TIME=%TIME%" 8 | SET "_START_DATE=%DATE%" 9 | 10 | 11 | PING -n %_TARGET% 127.0.0.1 > nul 12 | 13 | 14 | :Measure 15 | SET "_END_TIME=%TIME%" 16 | SET "_END_DATE=%DATE%" 17 | ECHO: 18 | ECHO _WAIT_SECONDS = %_WAIT_SECONDS% 19 | ECHO _TARGET = %_TARGET% 20 | ECHO _START_TIME = %_START_TIME% 21 | ECHO _END_TIME = %_END_TIME% 22 | CALL :ConvertTimeToSeconds "%_START_TIME%" 23 | SET "_START_TIME_SECS=%_TIME_SECONDS%" 24 | CALL :ConvertTimeToSeconds "%_END_TIME%" 25 | SET "_END_TIME_SECS=%_TIME_SECONDS%" 26 | IF NOT "%_START_DATE%"=="%_END_DATE%" ( 27 | REM ECHO Next day^! 28 | REM PAUSE 29 | SET /A "_TIME_DIFF=86400-%_START_TIME_SECS%" 30 | SET /A "_TIME_DIFF+=%_END_TIME_SECS%" 31 | ) ELSE ( 32 | SET /A "_TIME_DIFF=%_END_TIME_SECS%-%_START_TIME_SECS%" 33 | ) 34 | ::SET /A "_TIME_DIFF+=3600" & REM +60 mins 35 | ::SET /A "_TIME_DIFF+=4200" & REM +70 mins (1 hr 10 mins) 36 | ::SET /A "_TIME_DIFF+=86400" & REM +24 hrs 37 | CALL :ConvertSecondsToTime "%_TIME_DIFF%" 38 | ECHO Duration = %_TIME_FORMATTED% 39 | ECHO Duration = %_TIME_DURATION% 40 | ECHO _WAIT_SECONDS = %_WAIT_SECONDS% sec 41 | SET "_LOG=%~dpn0.csv" & REM This script's Drive letter, file Path, and file Name. https://ss64.com/nt/syntax-args.html 42 | IF NOT EXIST "%_LOG%" ECHO _TARGET,_TIME_IN_SECONDS> "%_LOG%" 43 | ECHO %_TARGET%,%_TIME_DIFF% >>"%_LOG%" 44 | ECHO: 45 | PAUSE 46 | 47 | :END 48 | EXIT /B & REM If you call this program from the command line and want it to return to CMD instead of closing Command Prompt, need to use EXIT /B or no EXIT command at all. 49 | 50 | REM ------------------------------------------------------------------------------- 51 | 52 | :DefineFunctions 53 | :: Declare Functions 54 | 55 | ::Index of functions: 56 | :: 1. :ConvertTimeToSeconds 57 | :: 2. :ConvertSecondsToTime 58 | 59 | GOTO SkipFunctions 60 | :------------------------------------------------------------------------------- 61 | :ConvertTimeToSeconds TimeValue [/D] 62 | :: Takes a given 24-hour time input like " 5:47:23.52" or "21-31-39" and converts it into seconds 63 | :: /D Include decimal calculations. If this switch is omitted any decimal values passed will be dropped. 64 | :: Output: %_TIME_SECONDS% 65 | @ECHO OFF 66 | SETLOCAL 67 | SET "_INPUT_TIME=%~1" 68 | SET "_SEC_SWITCH=%~2" 69 | :: https://ss64.com/nt/syntax-substring.html 70 | :: Extract Hours (first 2 digits) 71 | SET "_TIME_HOURS=%_INPUT_TIME:~0,2%" 72 | :: Bugfix: Check if first digit in hours is a zero (e.g. 09) or blank 73 | :: Extract the first character out of _TIME_HOURS 74 | SET "_TIME_HOURS_FIRST=%_TIME_HOURS:~0,1%" 75 | IF "%_TIME_HOURS_FIRST%"==" " ( 76 | REM Set _TIME_HOURS to the second character (instead of first 2 digits of string) 77 | SET "_TIME_HOURS=%_INPUT_TIME:~1,1%" 78 | ) ELSE ( 79 | IF "%_TIME_HOURS_FIRST%"=="0" ( 80 | REM Bugfix: Cannot use ' IF %_TIME_HOURS_FIRST% EQU 0 ' since if the first character is a space, it will still fail with "0 was unexpected at this time." Must do a string compare. 81 | REM Set _TIME_HOURS to the second character (instead of first 2 digits of string) 82 | SET "_TIME_HOURS=%_INPUT_TIME:~1,1%" 83 | ) 84 | ) 85 | ::ECHO Hour = %_TIME_HOURS% 86 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 87 | :: Extract Minutes (4th and 5th character) 88 | SET "_TIME_MINS=%_INPUT_TIME:~3,2%" 89 | :: Bugfix: Check if first digit in minutes is a zero (e.g. 09) 90 | :: Extract the first character out of _TIME_MINS 91 | SET "_TIME_MINS_FIRST=%_TIME_MINS:~0,1%" 92 | IF %_TIME_MINS_FIRST% EQU 0 ( 93 | REM Set _TIME_MINS to the 5th character, rather than the 4th and 5th characters 94 | SET "_TIME_MINS=%_INPUT_TIME:~4,1%" 95 | ) 96 | ::ECHO Mins = %_TIME_MINS% 97 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 98 | :: Extract Seconds (7th and 8th characters) 99 | SET "_TIME_SECS=%_INPUT_TIME:~6,2%" 100 | :: Bugfix: Check if first digit in seconds is a zero (e.g. 09) 101 | :: Extract the first character out of _TIME_SECS 102 | SET "_TIME_SECS_FIRST=%_TIME_SECS:~0,1%" 103 | IF %_TIME_SECS_FIRST% EQU 0 ( 104 | REM Extract the 8th character 105 | SET "_TIME_SECS=%_INPUT_TIME:~7,1%" 106 | ) 107 | ::ECHO Secs = %_TIME_SECS% 108 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 109 | :: Make hours into minutes (multiply by 60) 110 | SET /A "_TIME_HOURS_MINS=%_TIME_HOURS%*60" 111 | :: Add to minutes 112 | SET /A "_TIME_MINS+=%_TIME_HOURS_MINS%" 113 | :: Make minutes into seconds (multiply by 60) 114 | SET /A "_TIME_MINS_SECS=%_TIME_MINS%*60" 115 | :: Add to seconds 116 | SET /A "_TIME_SECS+=%_TIME_MINS_SECS%" 117 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 118 | SET "_SWITCH_LETTER=%_SEC_SWITCH:~1,1%" 119 | IF /I "%_SWITCH_LETTER%"=="D" ( 120 | REM Extract Seconds (everything after the 8th character) 121 | SET "_TIME_MILISECS=%_INPUT_TIME:~8%" 122 | REM Appends everything extracted (fractions of a second) to the end of our final seconds calculation. 123 | SET "_TIME_SECS=%_TIME_MINS_SECS%%_TIME_MILISECS%" 124 | ) 125 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 126 | ENDLOCAL & SET "_TIME_SECONDS=%_TIME_SECS%" 127 | EXIT /B 128 | :------------------------------------------------------------------------------- 129 | :ConvertSecondsToTime TimeValInSeconds 130 | :: Takes a value given in seconds and converts it into several time formats 131 | :: Outputs: 132 | :: "%_TIME_FORMATTED%" (will always be exactly 8 characters long) e.g. " 9:31:39" 133 | :: "%_TIME_SORTABLE%" (will always be exactly 8 characters long) e.g. "09-31-39" 134 | :: "%_TIME_DURATION%" (will always be exactly 12 characters long) e.g. " 9h 31m 39s" or "109h 7m 9s" 135 | @ECHO OFF 136 | SETLOCAL 137 | SET "_INPUT_SECS=%~1" 138 | :: https://ss64.com/nt/set.html 139 | :: Get minutes from seconds 140 | SET /A "_TIME_MINS=%_INPUT_SECS%/60" 141 | :: Keep the remainder as seconds 142 | SET /A "_TIME_SECS=%_INPUT_SECS%%%60" 143 | :: Get hours from minutes 144 | SET /A "_TIME_HOURS=%_TIME_MINS%/60" 145 | :: Keep the remainder as minutes 146 | SET /A "_TIME_MINS%%=60" 147 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 148 | :: Format time like " 9:31:39" (FORMATTED) 149 | IF %_TIME_HOURS% LSS 10 (SET "_FORM_HOURS= %_TIME_HOURS%") ELSE (SET "_FORM_HOURS=%_TIME_HOURS%") 150 | IF %_TIME_MINS% LSS 10 (SET "_FORM_MINS=0%_TIME_MINS%") ELSE (SET "_FORM_MINS=%_TIME_MINS%") 151 | IF %_TIME_SECS% LSS 10 (SET "_FORM_SECS=0%_TIME_SECS%") ELSE (SET "_FORM_SECS=%_TIME_SECS%") 152 | SET "_FORM_TIME=%_FORM_HOURS%:%_FORM_MINS%:%_FORM_SECS%" 153 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 154 | :: Format time like "09-31-39" (SORTABLE) 155 | IF %_TIME_HOURS% LSS 10 (SET "_SORT_HOURS=0%_TIME_HOURS%") ELSE (SET "_SORT_HOURS=%_TIME_HOURS%") 156 | IF %_TIME_MINS% LSS 10 (SET "_SORT_MINS=0%_TIME_MINS%") ELSE (SET "_SORT_MINS=%_TIME_MINS%") 157 | IF %_TIME_SECS% LSS 10 (SET "_SORT_SECS=0%_TIME_SECS%") ELSE (SET "_SORT_SECS=%_TIME_SECS%") 158 | SET "_SORT_TIME=%_SORT_HOURS%-%_SORT_MINS%-%_SORT_SECS%" 159 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 160 | :: Format time like " 9h 31m 39s" (DURATION) 161 | IF %_TIME_HOURS% LSS 100 (SET "_DUR_HOURS= %_TIME_HOURS%") ELSE (SET "_DUR_HOURS=%_TIME_HOURS%") 162 | IF %_TIME_HOURS% LSS 10 (SET "_DUR_HOURS= %_DUR_HOURS%") ELSE (SET "_DUR_HOURS=%_DUR_HOURS%") 163 | IF %_TIME_MINS% LSS 10 (SET "_DUR_MINS= %_TIME_MINS%") ELSE (SET "_DUR_MINS=%_TIME_MINS%") 164 | IF %_TIME_SECS% LSS 10 (SET "_DUR_SECS= %_TIME_SECS%") ELSE (SET "_DUR_SECS=%_TIME_SECS%") 165 | SET "_DUR_TIME=%_DUR_HOURS%h %_DUR_MINS%m %_DUR_SECS%s" 166 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 167 | ENDLOCAL & SET "_TIME_FORMATTED=%_FORM_TIME%" & SET "_TIME_SORTABLE=%_SORT_TIME%" & SET "_TIME_DURATION=%_DUR_TIME%" 168 | EXIT /B 169 | :------------------------------------------------------------------------------- 170 | :: End functions 171 | :SkipFunctions 172 | -------------------------------------------------------------------------------- /functions/DateMath.cmd: -------------------------------------------------------------------------------- 1 | :: Stolen from: http://ss64.com/nt/syntax-datemath.html 2 | 3 | @ECHO off 4 | SETLOCAL 5 | :: DateMath, a general purpose date math routine 6 | 7 | :: If DateMath detects an error, variable _dd_int is set to 999999. 8 | SET v_dd_int=0 9 | SET v_mm_int=0 10 | SET v_yy_int=0 11 | SET v_ymd_str= 12 | SET v_mm_str= 13 | SET v_dd_str= 14 | 15 | IF "%3"=="" goto s_syntax 16 | IF "%4"=="+" goto s_validate_year 17 | IF "%4"=="-" goto s_validate_year 18 | IF "%4"=="" goto s_validate_year 19 | 20 | :s_syntax 21 | echo. 22 | echo DATEMATH SYNTAX: 23 | echo _______________ 24 | echo. 25 | echo DateMath will set the variables as listed below 26 | echo 'str' variables include leading zeros e.g. "01" 27 | echo 'int' variables leading zeros are stripped e.g. "1" 28 | echo. 29 | echo CALL DateMath YY MM DD - YY2 MM2 DD2 30 | echo. 31 | echo Will set variable _dd_int to the signed difference 32 | echo between the 2 dates (measured in days) 33 | echo. 34 | echo. 35 | echo CALL DateMath YY MM DD +/- Days 36 | echo. 37 | echo Will set the following variables to the result of 38 | echo adding or substracting days from the initial date: 39 | echo _ymd_str, _yy_int 40 | echo _mm_str, _mm_int, 41 | echo _dd_str, _dd_int 42 | echo. 43 | echo. 44 | echo ___________________________________ 45 | pause 46 | 47 | echo. 48 | echo. 49 | echo CALL DateMath YY MM DD 50 | echo. 51 | echo Will set the following variables: 52 | echo _ymd_str, _yy_int 53 | echo _mm_str, _mm_int, 54 | echo _dd_str, _dd_int 55 | echo. 56 | echo ___________________________________ 57 | echo. 58 | echo _ymd_str is in YYYYMMDD format. 59 | echo. 60 | echo _yy_int is in YYYY format, even if YY format was originally supplied. 61 | echo This conversion is useful for FAT/NTFS file dates which are in YY format. 62 | echo. 63 | 64 | ENDLOCAL & SET /a _dd_int=999999 65 | goto :eof 66 | 67 | :s_validate_year 68 | ::strip leading zeros 69 | SET v_yy=%1 70 | if %v_yy:~0,1% EQU 0 set v_yy=%v_yy:~1% 71 | 72 | :: Check for Y2K 73 | IF %v_yy% LSS 100 IF %v_yy% GEQ 80 SET /A v_yy += 1900 74 | IF %v_yy% LSS 80 SET /A v_yy += 2000 75 | 76 | :: at this point v_yy contains a 4 digit year 77 | 78 | ::validate month and day 79 | if %2 GTR 12 goto s_syntax 80 | if %3 GTR 31 goto s_syntax 81 | 82 | SET v_mm=%2 83 | SET v_dd=%3 84 | 85 | ::strip leading zeros 86 | if %v_mm:~0,1% EQU 0 set v_mm=%v_mm:~1% 87 | if %v_dd:~0,1% EQU 0 set v_dd=%v_dd:~1% 88 | 89 | :: Set the int variables 90 | SET /a v_dd_int=%v_dd% 91 | SET /a v_yy_int=%v_yy% 92 | SET /a v_mm_int=%v_mm% 93 | 94 | :: Determine which function to perform - ADD, SUBTRACT or CONVERT 95 | 96 | If not "%6"=="" goto s_validate_2nd_date 97 | if "%4"=="" goto s_convert_only 98 | 99 | :: Add or subtract days to a date 100 | SET /a v_number_of_days=%5 101 | goto s_add_or_subtract_days 102 | 103 | :s_convert_only 104 | 105 | SET /a v_dd_int=%v_dd% 106 | IF %v_dd% LEQ 9 (SET v_dd_str=0%v_dd%) ELSE (SET v_dd_str=%v_dd%) 107 | IF %v_mm% LEQ 9 (SET v_mm_str=0%v_mm%) ELSE (SET v_mm_str=%v_mm%) 108 | SET v_ymd_str=%v_yy%%v_mm_str%%v_dd_str% 109 | 110 | ECHO DATEMATH - Convert date only (no maths) 111 | goto s_end 112 | :::::::::::::::::::::::::::::::::::::::::::::::::: 113 | 114 | :s_validate_2nd_date 115 | If "%4"=="+" goto s_syntax 116 | :: Subtracting one date from another :::::: 117 | :: strip leading zero 118 | SET v_yy2=%5 119 | if %v_yy2:~0,1% EQU 0 set v_yy2=%v_yy2:~1% 120 | 121 | if %v_yy2% GTR 99 goto s_validate2nd_month 122 | if %v_yy2% GTR 49 goto s_prefix_2_1950_1999 123 | if %v_yy2% LSS 10 goto s_prefix_2_2000_2009 124 | SET v_yy2=20%v_yy2% 125 | goto s_validate2nd_month 126 | 127 | :s_prefix_2_2000_2009 128 | SET v_yy2=200%v_yy2% 129 | goto s_validate2nd_month 130 | 131 | :s_prefix_2_1950_1999 132 | SET v_yy2=19%v_yy2% 133 | 134 | :s_validate2nd_month 135 | ::strip leading zeros 136 | ::SET /a v_yy2=%v_yy2% 137 | if %v_yy2:~0,1% EQU 0 set v_yy2=%v_yy2:~1% 138 | ::v_yy2 now contains a 4 digit year 139 | 140 | if %6 GTR 12 goto s_syntax 141 | SET v_mm2=%6 142 | 143 | if %7 GTR 31 goto s_syntax 144 | SET v_dd2=%7 145 | 146 | ::strip leading zeros 147 | ::SET /a v_mm2=%v_mm2% 148 | if %v_mm2:~0,1% EQU 0 set v_mm2=%v_mm2:~1% 149 | ::SET /a v_dd2=%v_dd2% 150 | if %v_dd2:~0,1% EQU 0 set v_dd2=%v_dd2:~1% 151 | 152 | call :s_julian_day %v_yy_int% %v_mm_int% %v_dd_int% 153 | SET v_sumdays1=%v_JulianDay% 154 | 155 | call :s_julian_day %v_yy2% %v_mm2% %v_dd2% 156 | SET v_sumdays2=%v_JulianDay% 157 | 158 | SET /a v_dd_int=%v_sumdays1% - %v_sumdays2% 159 | 160 | ECHO DATEMATH - Subtracting one date from another = days difference 161 | ECHO ~~~~~~ 162 | ECHO %v_dd_int% 163 | ECHO ~~~~~~ 164 | goto s_end_days 165 | :::::::::::::::::::::::::::::::::::::::::::::::::: 166 | 167 | :s_add_or_subtract_days 168 | if /i "%4"=="+" goto s_add_up_days 169 | 170 | :: Subtract all days :::::: 171 | SET /a v_dd=%v_dd% - %v_number_of_days% 172 | 173 | :s_adjust_month_year 174 | if %v_dd% GEQ 1 goto s_add_subtract_days_DONE 175 | SET /a v_mm=%v_mm% - 1 176 | if %v_mm% GEQ 1 goto s_add_days_%v_mm% 177 | SET /a v_yy=%v_yy% - 1 178 | SET /a v_mm=%v_mm% + 12 179 | goto s_add_days_%v_mm% 180 | 181 | :s_add_days_2 182 | SET /a v_dd=%v_dd% + 28 183 | SET /a v_leapyear=%v_yy% / 4 184 | SET /a v_leapyear=%v_leapyear% * 4 185 | if %v_leapyear% NEQ %v_yy% goto s_adjust_month_year 186 | SET /a v_dd=%v_dd% + 1 187 | goto s_adjust_month_year 188 | 189 | :s_add_days_4 190 | :s_add_days_6 191 | :s_add_days_9 192 | :s_add_days_11 193 | SET /a v_dd=%v_dd% + 30 194 | goto s_adjust_month_year 195 | 196 | :s_add_days_1 197 | :s_add_days_3 198 | :s_add_days_5 199 | :s_add_days_7 200 | :s_add_days_8 201 | :s_add_days_10 202 | :s_add_days_12 203 | SET /a v_dd=%v_dd% + 31 204 | goto s_adjust_month_year 205 | 206 | :s_add_up_days 207 | :: add all days :::::: 208 | SET /a v_dd=%v_dd% + %v_number_of_days% 209 | 210 | :s_subtract_days_ 211 | goto s_subtract_days_%v_mm% 212 | 213 | :s_adjust_mth_yr 214 | SET /a v_mm=%v_mm% + 1 215 | if %v_mm% LEQ 12 goto s_subtract_days_%v_mm% 216 | SET /a v_yy=%v_yy% + 1 217 | SET /a v_mm=%v_mm% - 12 218 | goto s_subtract_days_%v_mm% 219 | 220 | :s_subtract_days_2 221 | SET /a v_leapyear=%v_yy% / 4 222 | SET /a v_leapyear=%v_leapyear% * 4 223 | If %v_leapyear% EQU %v_yy% goto s_subtract_leapyear 224 | 225 | if %v_dd% LEQ 28 goto s_add_subtract_days_DONE 226 | SET /a v_dd=%v_dd% - 28 227 | goto s_adjust_mth_yr 228 | 229 | :s_subtract_leapyear 230 | if %v_dd% LEQ 29 goto s_add_subtract_days_DONE 231 | SET /a v_dd=%v_dd% - 29 232 | goto s_adjust_mth_yr 233 | 234 | :s_subtract_days_4 235 | :s_subtract_days_6 236 | :s_subtract_days_9 237 | :s_subtract_days_11 238 | if %v_dd% LEQ 30 goto s_add_subtract_days_DONE 239 | SET /a v_dd=%v_dd% - 30 240 | goto s_adjust_mth_yr 241 | 242 | :s_subtract_days_1 243 | :s_subtract_days_3 244 | :s_subtract_days_5 245 | :s_subtract_days_7 246 | :s_subtract_days_8 247 | :s_subtract_days_10 248 | :s_subtract_days_12 249 | if %v_dd% LEQ 31 goto s_add_subtract_days_DONE 250 | SET /a v_dd=%v_dd% - 31 251 | goto s_adjust_mth_yr 252 | 253 | :s_add_subtract_days_DONE 254 | SET /a v_dd_int=%v_dd% 255 | SET /a v_mm_int=%v_mm% 256 | SET /a v_yy_int=%v_yy% 257 | IF %v_dd% GTR 9 (SET v_dd_str=%v_dd%) ELSE (SET v_dd_str=0%v_dd%) 258 | IF %v_mm% GTR 9 (SET v_mm_str=%v_mm%) ELSE (SET v_mm_str=0%v_mm%) 259 | SET v_ymd_str=%v_yy%%v_mm_str%%v_dd_str% 260 | 261 | ECHO DATEMATH - add or subtract days from a date = new date 262 | goto s_end 263 | :::::::::::::::::::::::::::::::::::::::::::::::::: 264 | 265 | :s_julian_day 266 | SET v_year=%1 267 | SET v_month=%2 268 | SET v_day=%3 269 | 270 | SET /a v_month=v_month 271 | SET /a v_day=v_day 272 | 273 | SET /A a = 14 - v_month 274 | SET /A a /= 12 275 | SET /A y = v_year + 4800 - a 276 | SET /A m = v_month + 12 * a - 3 277 | SET /A m = 153 * m + 2 278 | SET /A m /= 5 279 | SET /A v_JulianDay = v_day + m + 365 * y + y / 4 - y / 100 + y / 400 - 32045 280 | 281 | ECHO The Julian Day is [%v_JulianDay%] 282 | goto :eof 283 | :::::::::::::::::::::::::::::::::::::::::::::::::: 284 | 285 | :s_end 286 | ECHO ~~~~~~~~~~~~ 287 | ECHO [%v_ymd_str%] YY=[%v_yy_int%] MM=[%v_mm_str%] DD=[%v_dd_str%] 288 | ECHO ~~~~~~~~~~~~ 289 | :s_end_days 290 | ENDLOCAL&SET /a _yy_int=%v_yy_int%&SET /a _mm_int=%v_mm_int%&SET /a _dd_int=%v_dd_int%&SET _ymd_str=%v_ymd_str%&SET _mm_str=%v_mm_str%&SET _dd_str=%v_dd_str% 291 | 292 | -------------------------------------------------------------------------------- /Linux/functions-template.sh: -------------------------------------------------------------------------------- 1 | 2 | # Index: 3 | # 1. Information & Description: 4 | # 2. Setup & Instructions: 5 | # 3. Parameters: 6 | # 4. Functions: 7 | # 5. Main: 8 | # 6. Footer: 9 | 10 | # ------------------------------------------------------------------------------- 11 | # Information & Description: 12 | 13 | # Clean-up log file for: 14 | # /home/pi/DynDNS/DynDNS-NameSilo-RottenEggs.py 15 | # e.g. 16 | # /home/pi/DynDNS/DynDNS-NameSilo-RottenEggs.log 17 | 18 | # /Information & Description 19 | # ------------------------------------------------------------------------------- 20 | # Setup & Instructions: 21 | 22 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 23 | 24 | # To copy this script to Raspberry Pi via PuTTY: 25 | #pscp "%UserProfile%\Documents\Flash Drive updates\Pi-Hole DNS server\DynDNS-NameSilo-RottenEggs-LogCleanup.sh" pi@my.pi:/home/pi/DynDNS/DynDNS-NameSilo-RottenEggs-LogCleanup.sh 26 | 27 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 28 | 29 | # Make script executable: 30 | # Note that to make a file executable, you must set the eXecutable bit, and for a shell script, the Readable bit must also be set: 31 | #cd /home/pi/DynDNS/ 32 | #ls -l 33 | #chmod a+rx DynDNS-NameSilo-RottenEggs-LogCleanup.sh 34 | #ls -l 35 | 36 | # Permissions breakdown: 37 | # drwxrwxrwx 38 | # | | | | 39 | # | | | others 40 | # | | group 41 | # | user 42 | # is directory? 43 | 44 | # u = owner of the file (user) 45 | # g = groups owner (group) 46 | # o = anyone else on the system (other) 47 | # a = all 48 | 49 | # + = add permission 50 | # - = remove permission 51 | 52 | # r = read permission 53 | # w = write permission 54 | # x = execute permission 55 | 56 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 57 | 58 | # To run this script: 59 | #/home/pi/DynDNS/DynDNS-NameSilo-RottenEggs-LogCleanup.sh 60 | #cd /home/pi/DynDNS/ 61 | #./DynDNS-NameSilo-RottenEggs-LogCleanup.sh 62 | 63 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 64 | 65 | # Schedule script to run automatically once every 2 weeks: 66 | #crontab -l 67 | #crontab -e 68 | #0 0 */14 * * /home/pi/DynDNS/DynDNS-NameSilo-RottenEggs-LogCleanup.sh 69 | #crontab -l 70 | 71 | # Schedule script to run automatically once every month: 72 | #crontab -l 73 | #crontab -e 74 | #0 0 1 */1 * /home/pi/DynDNS/DynDNS-NameSilo-RottenEggs-LogCleanup.sh 75 | #crontab -l 76 | 77 | # m h dom mon dow command 78 | 79 | # * * * * * command to execute 80 | # - - - - - 81 | # ¦ ¦ ¦ ¦ ¦ 82 | # ¦ ¦ ¦ ¦ ¦ 83 | # ¦ ¦ ¦ ¦ +----- day of week (0 - 7) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0) 84 | # ¦ ¦ ¦ +---------- month (1 - 12) 85 | # ¦ ¦ +--------------- day of month (1 - 31) 86 | # ¦ +-------------------- hour (0 - 23) 87 | # +------------------------- min (0 - 59) 88 | 89 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 90 | 91 | # /Setup & Instructions 92 | # ------------------------------------------------------------------------------- 93 | # Parameters: 94 | 95 | CURRENT_LOGFILE_PATH="/home/pi/DynDNS/DynDNS-NameSilo-RottenEggs.log" 96 | 97 | #ARCHIVE_LOGFILE_PATH="/home/pi/DynDNS/DynDNS-NameSilo-RottenEggs-LastTwoWeeks.log" 98 | ARCHIVE_LOGFILE_PATH="/home/pi/DynDNS/DynDNS-NameSilo-RottenEggs-LastMonth.log" 99 | 100 | 101 | # /Parameters 102 | # ------------------------------------------------------------------------------- 103 | # Functions: 104 | 105 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 106 | 107 | update_all_software() 108 | { 109 | yum check-update 110 | sudo yum update 111 | } 112 | 113 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 114 | 115 | # https://www.shellscript.sh/functions.html 116 | 117 | add_a_user() 118 | { 119 | USER=$1 120 | PASSWORD=$2 121 | shift; shift; 122 | # Having shifted twice, the rest is now comments ... 123 | COMMENTS=$@ 124 | echo "Adding user $USER ..." 125 | echo useradd -c "$COMMENTS" $USER 126 | echo passwd $USER $PASSWORD 127 | echo "Added user $USER ($COMMENTS) with pass $PASSWORD" 128 | } 129 | 130 | adduser() 131 | { 132 | USER=$1 133 | PASSWORD=$2 134 | shift; shift; 135 | # Having shifted twice, the rest is now comments ... 136 | COMMENTS=$@ 137 | useradd -c "${COMMENTS}" $USER 138 | if [ "$?" -ne "0" ]; then 139 | echo "Useradd failed" 140 | return 1 141 | fi 142 | passwd $USER $PASSWORD 143 | if [ "$?" -ne "0" ]; then 144 | echo "Setting password failed" 145 | return 2 146 | fi 147 | echo "Added user $USER ($COMMENTS) with pass $PASSWORD" 148 | } 149 | 150 | #adduser bob letmein Bob Holness from Blockbusters 151 | #ADDUSER_RETURN_CODE=$? 152 | #if [ "$ADDUSER_RETURN_CODE" -eq "1" ]; then 153 | # echo "Something went wrong with useradd" 154 | #elif [ "$ADDUSER_RETURN_CODE" -eq "2" ]; then 155 | # echo "Something went wrong with passwd" 156 | #else 157 | # echo "Bob Holness added to the system." 158 | #fi 159 | 160 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 161 | 162 | # https://www.shellscript.sh/functions.html 163 | 164 | factorial() 165 | { 166 | if [ "$1" -gt "1" ]; then 167 | i=`expr $1 - 1` 168 | j=`factorial $i` 169 | k=`expr $1 \* $j` 170 | echo $k 171 | else 172 | echo 1 173 | fi 174 | } 175 | 176 | #while : 177 | #do 178 | # echo "Enter a number:" 179 | # read x 180 | # factorial $x 181 | #done 182 | 183 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 184 | 185 | # /Functions 186 | # ------------------------------------------------------------------------------- 187 | # Main: 188 | 189 | # ------------------------------------------------------------------------------- 190 | # =============================================================================== 191 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 192 | 193 | # Index of Main: 194 | #=============================================================================== 195 | # 1: Get physical drives on system and partiotions 196 | # 2: Get total size and % used for each physical drive 197 | # 3: Edit partitions 198 | # 4: Format disks 199 | # 5: Mount/Un-mount drives to filesystem 200 | #=============================================================================== 201 | 202 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 203 | 204 | # https://www.shellscript.sh/ 205 | 206 | # Delete archive log file: 207 | echo "Deleting archive log file (if exists):" 208 | echo $ARCHIVE_LOGFILE_PATH 209 | if [ -f $ARCHIVE_LOGFILE_PATH ]; then 210 | # File exists. 211 | echo "Deleting file..." 212 | rm $ARCHIVE_LOGFILE_PATH 213 | else 214 | # File does not exist. 215 | echo "File does not exist." 216 | fi 217 | 218 | # Copy current log file to archive position: 219 | echo $'\n'"Copying current log file to archive position:" 220 | echo current: $CURRENT_LOGFILE_PATH 221 | echo archive: $ARCHIVE_LOGFILE_PATH 222 | cp $CURRENT_LOGFILE_PATH $ARCHIVE_LOGFILE_PATH 223 | 224 | # Append footer message to archive log file: 225 | echo $'\n'"Wrapping-up archive log file:" 226 | #CURRENT_TIMESTAMP=`date --iso-8601=ns` 227 | CURRENT_TIMESTAMP=`date --rfc-3339=seconds` 228 | echo "Current date/time: $CURRENT_TIMESTAMP" 229 | echo "-------------------------------------------------------------------------------" >> $ARCHIVE_LOGFILE_PATH 230 | echo $'\n' >> $ARCHIVE_LOGFILE_PATH 231 | echo "-------------------------------------------------------------------------------" >> $ARCHIVE_LOGFILE_PATH 232 | echo "Archived:" $CURRENT_TIMESTAMP $'\n' >> $ARCHIVE_LOGFILE_PATH 233 | echo $'\n' >> $ARCHIVE_LOGFILE_PATH 234 | 235 | # Delete current log file: 236 | echo $'\n'"Deleting current log file:" 237 | echo $CURRENT_LOGFILE_PATH 238 | rm $CURRENT_LOGFILE_PATH 239 | 240 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 241 | 242 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 243 | # =============================================================================== 244 | # ------------------------------------------------------------------------------- 245 | 246 | # /Main 247 | # ------------------------------------------------------------------------------- 248 | # Footer: 249 | 250 | echo "End of script." 251 | echo $'\n' 252 | exit 0 253 | 254 | # /Footer 255 | # ------------------------------------------------------------------------------- 256 | 257 | 258 | 259 | -------------------------------------------------------------------------------- /functions/splash/space-ascii-art.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | REM ------------------------------------------------------------------------------- 4 | REM =============================================================================== 5 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6 | 7 | 8 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9 | # ======================================================================================================================= 10 | # ----------------------------------------------------------------------------------------------------------------------- 11 | 12 | https://www.asciiart.eu/space/spaceships 13 | 14 | 15 | _ _ ____________.--. 16 | |\|_|//_.-"" .' \ /| | 17 | |.-"""-.| / \_/ | | 18 | \ || /| __\_____________ | 19 | _\_||_/_| .-"" ""-. __ 20 | .' '. \// ".\/ 21 | || '. >()_ |()< 22 | ||__.-' |/\ \ |/\ 23 | | / "| \__________________/."" 24 | / // | / \ "-.__________/ /\ 25 | ___|__/_|__|/___\___".______//__/__\ 26 | /|\ [____________] \__/ |\ 27 | //\ \ | |=====| | /\\ |\\ 28 | // |\ \ | |=====| | | \\ | \\ ____...____....---- 29 | .//__| \ \ | |=====| | | |\\ |--\\---"""" . .. 30 | _____....-//___| \_\ | |=====| | |_|_\\ |___\\ . ...' 31 | . .//-.__|_______|__|_____|_|_____[__\\_____|__.-\\ . . ...:: 32 | // // / \ `-_\\/ \\ .....::: 33 | -... // . / / /____________\ \\ . \ \ . . 34 | // .. .-/_/-. . \\ .-\_\-. . 35 | / / '-----' . \ \ '._____.' . 36 | .-/_/-. . .-\_\-. ... 37 | '._____.' . '._____.' ..... 38 | . ...... .. 39 | . . . . 40 | ... . . . . 41 | .... . . .... 42 | JRO ...... . .. ......' 43 | ....... '... .... 44 | '''''' . . 45 | 46 | From: spupette@hotmail.com (Soque (Enjoque) Pupette) 47 | 48 | 49 | 50 | 51 | # ----------------------------------------------------------------------------------------------------------------------- 52 | 53 | https://www.asciiart.eu/space/spaceships 54 | 55 | 56 | `. ___ 57 | __,' __`. _..----....____ 58 | __...--.'``;. ,. ;``--..__ .' ,-._ _.-' 59 | _..-''-------' `' `' `' O ``-''._ (,;') _,' 60 | ,'________________ \`-._`-',' 61 | `._ ```````````------...___ '-.._'-: 62 | ```--.._ ,. ````--...__\-. 63 | `.--. `-` ____ | |` 64 | `. `. ,'`````. ; ;` 65 | `._`. __________ `. \'__/` 66 | `-:._____/______/___/____`. \ ` 67 | | `._ `. \ 68 | `._________`-. `. `.___ 69 | SSt `------'` 70 | 71 | 72 | 73 | 74 | # ----------------------------------------------------------------------------------------------------------------------- 75 | 76 | https://www.asciiart.eu/space/moons 77 | 78 | 79 | woman in the moon 80 | 81 | + 82 | ---====D @ 83 | o ,,*:*::,.__ * 84 | * ,)))*))))* __.=-. o 85 | | ,((*((a a))-' 86 | -O- ,))))))\ = / =( = + 87 | + | ,(((*(((()-( * 88 | *))))))/ `\ 89 | (((*}(//(_|_)\\ . 90 | )*))))\\*).( // + . 91 | * (((((*(// / )/ | 92 | ))))))/ / /` -O- @ 93 | + `(*(((/ /` | 94 | o `)))*))`\ * 95 | `(((( `-.__ , . 96 | . *)-._ `--~jgs` 97 | @ + `~---~~` * 98 | 99 | * . o + 100 | 101 | 102 | 103 | # ----------------------------------------------------------------------------------------------------------------------- 104 | 105 | https://www.asciiart.eu/space/moons 106 | 107 | , 108 | _=|_ 109 | _[_## ]_ 110 | _ +[_[_+_]P/ _ |_ ____ _=--|-~ 111 | ~---\_I_I_[=\--~ ~~--[o]--==-|##==]-=-~~ o]H 112 | -~ /[_[_|_]_]\\ -_ [[=]] |====] __ !j]H 113 | / "|" \ ^U-U^ - | - ~ .~ U/~ 114 | ~~--__~~~--__~~-__ H_H_ |_ -- _H_ 115 | -. _ ~~~#######~~~ ~~~- ~~-- ._ - ~~-= 116 | ~~~=~~ -~~-- _ . - _ _ - 117 | 118 | ---------------------------------- 119 | | June, 20th, 1969 | 120 | | Here Men from the Planet Earth | 121 | | First set Foot upon the Moon | 122 | | We came in Peace for all Mankind | 123 | ---------------------------=apx=-- 124 | 125 | # ----------------------------------------------------------------------------------------------------------------------- 126 | 127 | https://www.asciiart.eu/space/moons 128 | 129 | man in the moon 130 | 131 | ______ \'/ 132 | .-'` . `'-. -= * =- 133 | .' ' .---. '. /.\ 134 | / ' .' `'. \ 135 | ; ' / \| 136 | : ' _ ; ` 137 | ; : /(\ \ 138 | | . '. 139 | | ' / --' 140 | | . '.__\ 141 | ; : / 142 | ; . | , 143 | ; . \ /| 144 | \ . '. .'/ 145 | '. ' . `'---'`.' 146 | jgs `'-..._____.-` 147 | 148 | 149 | # ----------------------------------------------------------------------------------------------------------------------- 150 | 151 | https://www.asciiart.eu/space/moons 152 | 153 | Phases of the Moon 154 | 155 | _..._ 156 | .:::::::. 157 | ::::::::::: NEW MOON 158 | ::::::::::: 159 | `:::::::::' 160 | `':::'' 161 | _..._ 162 | .::::. `. 163 | :::::::. : WAXING CRESCENT 164 | :::::::: : 165 | `::::::' .' 166 | `'::'-' 167 | _..._ 168 | .:::: `. 169 | :::::: : FIRST QUARTER 170 | :::::: : 171 | `::::: .' 172 | `'::.-' 173 | _..._ 174 | .::' `. 175 | ::: : WAXING GIBBOUS 176 | ::: : 177 | `::. .' 178 | `':..-' 179 | _..._ 180 | .' `. 181 | : : FULL MOON 182 | : : 183 | `. .' 184 | `-...-' 185 | _..._ 186 | .' `::. 187 | : ::: WANING GIBBOUS 188 | : ::: 189 | `. .::' 190 | `-..:'' 191 | _..._ 192 | .' ::::. 193 | : :::::: LAST QUARTER 194 | : :::::: 195 | `. :::::' 196 | `-.::'' 197 | _..._ 198 | .' .::::. 199 | : :::::::: WANING CRESCENT 200 | : :::::::: 201 | `. '::::::' 202 | jgs `-.::'' 203 | _..._ 204 | .:::::::. 205 | ::::::::::: NEW MOON 206 | ::::::::::: 207 | `:::::::::' 208 | `':::'' 209 | 210 | 211 | 212 | # ----------------------------------------------------------------------------------------------------------------------- 213 | 214 | 215 | # ----------------------------------------------------------------------------------------------------------------------- 216 | 217 | 218 | # ----------------------------------------------------------------------------------------------------------------------- 219 | 220 | 221 | # ----------------------------------------------------------------------------------------------------------------------- 222 | 223 | 224 | # ----------------------------------------------------------------------------------------------------------------------- 225 | 226 | 227 | 228 | -------------------------------------------------------------------------------- /Tools/Debug-TroubleshootBatchFile.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | SETLOCAL 3 | :: CMD /K Debug-TroubleshootBatchFile.bat 4 | :: CMD /K Debug-TroubleshootBatchFile.bat "%USERPROFILE%\Documents\SpiderOak Hive\Programming\Batch\+Function Library\Functions list\functions-template.bat" 5 | :: CMD /K Debug-TroubleshootBatchFile.bat "%USERPROFILE%\Documents\SpiderOak Hive\Programming\Batch\+Function Library\Functions list\functions-template.bat" "Param2" "Param3" 6 | 7 | ::Index: 8 | :: 1. :RunAsAdministrator 9 | :: 2. :Header 10 | :: 3. :Parameters 11 | :: 4. :Main 12 | :: 5. :Footer 13 | 14 | REM Bugfix: Use "REM ECHO DEBUG*ING: " instead of "::ECHO DEBUG*ING: " to comment-out debugging lines, in case any are within IF statements. 15 | REM ECHO DEBUGGING: Begin RunAsAdministrator block. 16 | 17 | :RunAsAdministrator 18 | :: SS64 Run with elevated permissions script (ElevateMe.vbs) 19 | :: Thanks to: http://ss64.com/vb/syntax-elevate.html 20 | :------------------------------------------------------------------------------- 21 | :: First check if we are running As Admin/Elevated 22 | FSUTIL dirty query %SystemDrive% >nul 23 | IF %ERRORLEVEL% EQU 0 GOTO START 24 | 25 | ::GOTO START & REM <-- Leave this line in to always skip Elevation Prompt --> 26 | ::GOTO NOCHOICE & REM <-- Leave this line in to always Elevate to Administrator (skip choice) --> 27 | ECHO: 28 | ECHO CHOICE Loading... 29 | ECHO: 30 | :: https://ss64.com/nt/choice.html 31 | CHOICE /M "Run as Administrator?" 32 | IF ERRORLEVEL 2 GOTO START & REM No. 33 | IF ERRORLEVEL 1 REM Yes. 34 | :NOCHOICE 35 | 36 | :: wait 2 seconds, in case this user is not in Administrators group. (To prevent an infinite loop of UAC admin requests on a restricted user account.) 37 | ECHO Requesting administrative privileges... ^(waiting 2 seconds^) 38 | PING -n 3 127.0.0.1 > nul 39 | 40 | ::Create and run a temporary VBScript to elevate this batch file 41 | :: https://ss64.com/nt/syntax-args.html 42 | SET _batchFile=%~s0 43 | SET _batchFile=%~f0 44 | SET _Args=%* 45 | IF NOT [%_Args%]==[] ( 46 | REM double up any quotes 47 | REM https://ss64.com/nt/syntax-replace.html 48 | SET "_Args=%_Args:"=""%" 49 | REM Bugfix: cannot use :: for comments within IF statement, instead use REM 50 | ) 51 | :: https://ss64.com/nt/if.html 52 | IF ["%_Args%"] EQU [""] ( 53 | SET "_CMD_RUN=%_batchFile%" 54 | ) ELSE ( 55 | SET "_CMD_RUN=""%_batchFile%"" %_Args%" 56 | ) 57 | :: https://ss64.com/vb/shellexecute.html 58 | ECHO Set UAC = CreateObject^("Shell.Application"^) > "%Temp%\~ElevateMe.vbs" 59 | ECHO UAC.ShellExecute "CMD", "/C ""%_CMD_RUN%""", "", "RUNAS", 1 >> "%Temp%\~ElevateMe.vbs" 60 | :: ECHO UAC.ShellExecute "CMD", "/K ""%_batchFile% %_Args%""", "", "RUNAS", 1 >> "%temp%\~ElevateMe.vbs" 61 | 62 | cscript "%Temp%\~ElevateMe.vbs" 63 | EXIT /B 64 | 65 | :START 66 | :: set the current directory to the batch file location 67 | ::CD /D %~dp0 68 | :------------------------------------------------------------------------------- 69 | :: End Run-As-Administrator function 70 | 71 | :Header 72 | ::GOTO SkipHeader & REM Un-comment this line to skip Header 73 | ::ECHO: 74 | REM ECHO DEBUGGING: Script name ^( %~nx0 ^) & REM This script's file name and extension. https://ss64.com/nt/syntax-args.html 75 | REM ECHO DEBUGGING: Working directory: %~dp0 & REM The drive letter and path of this script's location. 76 | REM ECHO DEBUGGING: Current directory: %CD% & REM The path of the currently selected directory. 77 | ::ECHO: 78 | 79 | :: Check if we are running As Admin/Elevated 80 | FSUTIL dirty query %SystemDrive% >nul 81 | IF %ERRORLEVEL% EQU 0 ( 82 | REM ECHO DEBUGGING: Elevated Permissions: YES 83 | ) ELSE ( 84 | REM ECHO DEBUGGING: Elevated Permissions: NO 85 | REM ------------------------------------------------------------------------------- 86 | REM Bugfix: cannot use :: for comments within IF statement, instead use REM 87 | REM Bugfix: cannot use ECHO( for newlines within IF statement, instead use ECHO. or ECHO: 88 | ) 89 | 90 | REM ECHO DEBUGGING: Input parameters [%1] [%2] [%3] ... 91 | ::ECHO: 92 | ::PAUSE 93 | ::CLS 94 | :SkipHeader 95 | 96 | :: End Header 97 | 98 | REM ------------------------------------------------------------------------------- 99 | 100 | REM ECHO DEBUGGING: Begin Parameters block. 101 | 102 | :Parameters 103 | 104 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 105 | 106 | :: Param1 = Script to Debug 107 | 108 | SET "_BatchPath=%~1" & REM %~1 Expand %1 removing any surrounding quotes (") 109 | SET "_BatchPath=.\Install-AllWindowsUpdates.bat" 110 | REM e.g. "%USERPROFILE%\Documents\SpiderOak Hive\Programming\Batch\+Function Library\Functions list\functions-template.bat" 111 | SET "_BatchPath=%USERPROFILE%\Documents\SpiderOak Hive\Programming\Batch\+Function Library\Functions list\functions-template.bat" 112 | REM SET "_BatchPath=%USERPROFILE%\Documents\SpiderOak Hive\SysAdmin\Flash Drive\General Flash Drive\Launch-AD_ElevatedCMD.bat" 113 | SET "_BatchPath=%USERPROFILE%\Documents\Hg\Resume\Portfolio Finals\Sanitize-PDF.bat" 114 | ::SET "_BatchPath=.\Sanitize-PDF.bat" 115 | SET "_BatchPath=%USERPROFILE%\Documents\GitHub\Batch-Tools-SysAdmin\Call-Test.bat" 116 | SET "_BatchPath=%USERPROFILE%\Documents\GitHub\Batch-Tools-SysAdmin\Remote Access\Access-AdministrativeShare.bat" 117 | 118 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 119 | 120 | :: Param2 = Options/Parameters to pass to Script 121 | 122 | SET "_Options=" 123 | 124 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 125 | 126 | :: End Parameters 127 | 128 | REM ------------------------------------------------------------------------------- 129 | REM =============================================================================== 130 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 131 | :Main 132 | 133 | REM ECHO DEBUGGING: Beginning Main execution block. 134 | 135 | ::Index of Main: 136 | 137 | ::=============================================================================== 138 | :: Phase 1: Evaluate Parameters 139 | :: Phase 2: Execute script 140 | ::=============================================================================== 141 | 142 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 143 | 144 | ::=============================================================================== 145 | :: Phase 1: Evaluate Parameters 146 | ::=============================================================================== 147 | 148 | ECHO( 149 | IF "%~1"=="" ( 150 | REM No input parameters were given. 151 | REM Use hard-coded script location 152 | SET "DebugScript=%_BatchPath%" 153 | ECHO Script-coded locaation selected. 154 | ECHO: 155 | ) ELSE ( 156 | REM Use input parameters. 157 | SET "DebugScript=%~1" 158 | ECHO Commandline parameter input selected. ^(drag-n-drop mode^) 159 | ECHO: 160 | REM >------------------------------------------------------------------------------- 161 | REM Bugfix: cannot use :: for comments within IF statement, instead use REM 162 | REM Bugfix: cannot use ECHO( for newlines within IF statement, instead use ECHO. or ECHO: 163 | ) 164 | 165 | ::------------------------------------------------------------------------------- 166 | 167 | IF NOT EXIST "%DebugScript%" ( 168 | ECHO: 169 | ECHO "%DebugScript%" does not exist. 170 | ECHO: 171 | PAUSE 172 | GOTO END 173 | ) 174 | 175 | ::------------------------------------------------------------------------------- 176 | 177 | ::=============================================================================== 178 | :: Phase 2: Execute script 179 | ::=============================================================================== 180 | 181 | ECHO Launching script in DEBUG mode: 182 | ECHO( 183 | ECHO %DebugScript% 184 | ECHO( 185 | 186 | ECHO ------------------------------------------------------------------------------- 187 | ECHO ------------------------------------------------------------------------------- 188 | ECHO ------------------------------------------------------------------------------- 189 | ECHO( 190 | PAUSE 191 | ECHO( 192 | ECHO ------------------------------------------------------------------------------- 193 | ECHO ------------------------------------------------------------------------------- 194 | ECHO ------------------------------------------------------------------------------- 195 | ECHO( 196 | 197 | CMD /K "%DebugScript%" 198 | 199 | ECHO ------------------------------------------------------------------------------- 200 | ECHO ------------------------------------------------------------------------------- 201 | ECHO ------------------------------------------------------------------------------- 202 | ECHO End %DebugScript% 203 | ECHO ------------------------------------------------------------------------------- 204 | ECHO ------------------------------------------------------------------------------- 205 | ECHO ------------------------------------------------------------------------------- 206 | 207 | ::------------------------------------------------------------------------------- 208 | 209 | :Footer 210 | :END 211 | ENDLOCAL 212 | ECHO: 213 | ECHO End %~nx0 214 | ECHO: 215 | PAUSE 216 | ::GOTO :EOF 217 | EXIT /B & REM If you call this program from the command line and want it to return to CMD instead of closing Command Prompt, need to use EXIT /B or no EXIT command at all. 218 | -------------------------------------------------------------------------------- /Backup and Restore/Transferring Files/Robocopy/robocopy-files.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | SETLOCAL 3 | @echo off 4 | REM Remember to Run As Administrator otherwise script will silently fail! 5 | REM Get Admin rights. 6 | REM Step 1: Get UAC Admin Rights 7 | :: ------- Start Script ------- 8 | REM Note, this will not work if run from a network share. 9 | 10 | REM From: https://sites.google.com/site/eneerge/home/BatchGotAdmin 11 | :: BatchGotAdmin 12 | :------------------------------------------------------------------------------- 13 | REM --> Check for permissions 14 | >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 15 | 16 | REM --> If error flag set, we do not have admin. 17 | if '%errorlevel%' NEQ '0' ( 18 | REM NOTIFY user: 19 | echo Requesting administrative privileges... 20 | goto UACPrompt 21 | ) else ( goto gotAdmin ) 22 | 23 | :UACPrompt 24 | echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 25 | echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" 26 | 27 | "%temp%\getadmin.vbs" 28 | exit /B 29 | 30 | :gotAdmin 31 | if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" ) 32 | pushd "%CD%" 33 | CD /D "%~dp0" 34 | :------------------------------------------------------------------------------- 35 | REM ------------------------------------------------------------------------------- 36 | REM =============================================================================== 37 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 38 | :: Set vars 39 | set "_SOURCE_LOC=D:\Docs\+VideoProjects" 40 | :: 41 | set "_DEST_LOC=%USERPROFILE%\Documents\+VideoProjects" 42 | :: To save logs in same directory as this script, set "_LOG_PATH=%~dp0" 43 | set "_LOG_PATH=%~dp0" 44 | :: 45 | 46 | REM Abstract other VARS from source 47 | REM --get drive letter of source 48 | FOR /F %%G IN ("%_SOURCE_LOC%") DO (SET _SOURCE_LETT=%%~dG) 49 | :: Set RoboCopy switches 50 | :: 51 | :: 52 | :: Define the options/switches you want here (will apply to real copy as well): 53 | set "ROBOSWITCHES=/E /XF pagefile.sys hiberfil.sys Backup-PC-HomeComp3-18-11.TBI /XD "%_SOURCE_LETT%\System Volume Information^" %_SOURCE_LETT%\$Recycle.Bin %_SOURCE_LETT%\tmp ^/XJ ^/TEE" 54 | :: 55 | :: 56 | :: 57 | REM Abstract other VARS from source 58 | REM --Escape ampersands 59 | set _SOURCE_LOC_FORM=%_SOURCE_LOC:&=^^^&% 60 | set _DEST_LOC_FORM=%_DEST_LOC:&=^^^&% 61 | 62 | echo( 63 | 64 | REM --escape double quotes 65 | set _ROBOSWITCH_MAD=%ROBOSWITCHES:"=^^^"% 66 | 67 | echo( 68 | 69 | 70 | :: ROBOCOPY Options/Switches Descriptions: (NOTE THIS LIST IS NOT COMPLETE) 71 | :: robocopy "" "" 72 | :: Network locations cannot be referred to by a mapped drive letter, and must be "\\computername\sharedfolder\..." 73 | :: e.g. ROBOCOPY C:\source D:\dest *.* /XD "C:\System Volume Information" "C:\$Recycle.Bin" "C:\tmp" /XF pagefile.sys hiberfil.sys 74 | 75 | :: /S - copies Subdirectories, excluding any empty subdirectories. 76 | :: /E - copies subdirectories including Empty ones. For additional information, see Remarks. 77 | :: /COPY: 78 | :: Specifies the file properties to be copied. The following are the valid values for this option: 79 | :: D - Data 80 | :: A - Attributes 81 | :: T - Time stamps 82 | :: S - NTFS access control list (ACL) 83 | :: O - Owner information 84 | :: U - Auditing information 85 | :: The default value for CopyFlags is DAT (data, attributes, and time stamps). 86 | :: /COPYALL - Copies all file information (equivalent to /copy:DATSOU). 87 | :: /DCOPY:T - COPY Directory Timestamps. 88 | :: /SECFIX - FIX file SECurity on all files, even skipped files. 89 | :: /TIMFIX - FIX file TIMes on all files, even skipped files. 90 | :: /MIR - Mirrors a directory tree (equivalent to /e plus /purge), deletes any destination files. Note that when used with /Z (or MAYBE even /XO) it does not delete already copied files at the destination (useful for resuming a copy) 91 | :: /PURGE - delete dest files/dirs that no longer exist in source. 92 | 93 | :: /MOV : MOVe files (delete from source after copying). 94 | :: /MOVE : Move files and dirs (delete from source after copying). 95 | 96 | :: /L - Specifies that files are to be listed only (and not copied, deleted, or time stamped). 97 | :: /NP - No Progress – don’t display % copied. 98 | :: /ETA - Shows the estimated time of arrival (ETA) of the copied files. 99 | :: /BYTES - Print sizes as bytes. 100 | :: /LOG: - Writes the status output to the log file. (overwrites the existing log file) 101 | :: /LOG+: - Appends output to the log file. 102 | :: /TEE - Output to console window, as well as the log file. 103 | 104 | :: /IS - Include Same, overwrite files even if they are already the same. 105 | :: /IT - Include Tweaked files. 106 | :: /X - Report all eXtra files, not just those selected & copied. 107 | :: /FFT - uses fat file timing instead of NTFS. This means the granularity is a bit less precise. For across-network share operations this seems to be much more reliable - just don't rely on the file timings to be completely precise to the second. 108 | 109 | :: /Z - ensures Robocopy can resume the transfer of a large file in mid-file instead of restarting. (Restart Mode)(survive network glitch).(maybe for Network Copys) 110 | :: /B - copies in Backup Modes (overrides ACLs for files it doesn't have access to so it can copy them. Requires User-Level or Admin permissions) 111 | :: /ZB : Use restartable mode; if access denied use Backup mode. 112 | :: /R:n - Number of Retries on failed copies - default is 1 million. 113 | :: /W:n - Wait time between retries - default is 30 seconds. 114 | :: /REG - Save /R:n and /W:n in the Registry as default settings. 115 | 116 | :: /XO - Excludes older files. (Only copies newer and changed files) 117 | :: /XX : eXclude "eXtra" files and dirs (present in destination but not source) 118 | :: This will prevent any deletions from the destination. (this is the default) (http://ss64.com/nt/robocopy.html) 119 | :: /XJ - eXclude Junction points. (normally included by default). In Windows 7 Junction Points were introduced which adds symbolic-like-links for "Documents and Settings" which redirect to "C:\User\Documents" for old program compatibility. Sometimes they can throw ROBOCOPY into a loop and it will copy the same files more than once. 120 | :: /XF [ ...] Excludes files that match the specified names or paths. Note that FileName can include wildcard characters (* and ?). 121 | :: /XD [ ...] Excludes directories that match the specified names and paths. 122 | :: XF and XD can be used in combination e.g. ROBOCOPY c:\source d:\dest /XF *.doc *.xls /XD c:\unwanted /S 123 | :: e.g. ROBOCOPY C:\source D:\dest *.* /XD "C:\System Volume Information" "C:\$Recycle.Bin" "C:\tmp" /XF pagefile.sys hiberfil.sys 124 | 125 | :: Job Options 126 | :: /JOB:jobname : Take parameters from the named JOB file. 127 | :: /SAVE:jobname : SAVE parameters to the named job file 128 | :: /QUIT : QUIT after processing command line (to view parameters). 129 | 130 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 131 | REM =============================================================================== 132 | REM ------------------------------------------------------------------------------- 133 | REM CLS 134 | echo( 135 | echo ------------------------------------------------------------------------------- 136 | echo( 137 | echo ROBOCOPY for large file transfers! 138 | echo( 139 | echo T - for Test copy (log only) 140 | echo Y - Yes, perform full copy 141 | echo N - No/Abort 142 | echo( 143 | CHOICE /C TYN /M "Are you ready?" 144 | IF ERRORLEVEL 3 GOTO END 145 | IF ERRORLEVEL 2 GOTO COPY 146 | IF ERRORLEVEL 1 GOTO TEST 147 | GOTO END 148 | 149 | :COPY 150 | set "SHHHHTESTING=/l " 151 | set "SHHHHTESTING=" 152 | set "PRINTTOSCREEN=/eta " 153 | set "NOPROGRESS=/NP " 154 | set "NOPROGRESS=" 155 | set "RETRYSETTINS=/r:1 /w:1 " 156 | REM NOTIFY user: 157 | echo( 158 | REM echo ROBOCOPY %_SOURCE_LOC%\ %_DEST_LOC_FORM%\ *.* /S /XF pagefile.sys hiberfil.sys Backup-PC-HomeComp3-18-11.TBI /XD "%_SOURCE_LETT%\System Volume Informatio^" %_SOURCE_LETT%\$Recycle.Bin %_SOURCE_LETT%\tmp /XJ /TEE %NOPROGRESS%%RETRYSETTINS%%PRINTTOSCREEN%%SHHHHTESTING%/log+:"%_LOG_PATH%ROBOCOPY.log" 159 | echo( 160 | echo This one's the real deal! You sure? 161 | echo( 162 | pause 163 | echo( 164 | echo Performing copy... 165 | echo( 166 | 167 | ROBOCOPY %_SOURCE_LOC%\ %_DEST_LOC%\ *.* /E /XF pagefile.sys hiberfil.sys Backup-PC-HomeComp3-18-11.TBI /XD "%_SOURCE_LETT%\System Volume Information" %_SOURCE_LETT%\$Recycle.Bin %_SOURCE_LETT%\tmp /XJ /TEE %NOPROGRESS%%RETRYSETTINS%%PRINTTOSCREEN%%SHHHHTESTING%/log+:"%_LOG_PATH%ROBOCOPY.log" 168 | REM To interrupt a in-progress copy use Ctrl+C, and /XO & /Z switches to resume from last left off. 169 | :: 170 | :: 171 | :: 172 | REM START "Performing ROBOCOPY..." /W "robocopy" %_SOURCE_LOC%\ %_DEST_LOC%\ *.* %ROBOSWITCHES% %NOPROGRESS%%RETRYSETTINS%%PRINTTOSCREEN%%SHHHHTESTING%/log+:"%_LOG_PATH%ROBOCOPY.log" 173 | :: 174 | :: 175 | :: 176 | echo =============================================================================== 177 | echo RoboCopy script Complete! 178 | echo( 179 | pause 180 | GOTO END 181 | 182 | :TEST 183 | set "SHHHHTESTING=" 184 | set "SHHHHTESTING=/L " 185 | set "PRINTTOSCREEN=/eta " 186 | set "PRINTTOSCREEN=" 187 | set "NOPROGRESS=" 188 | set "NOPROGRESS=/NP " 189 | set "RETRYSETTINS=/r:0 /w:0 " 190 | echo( 191 | echo TESTING TESTING TESTING ... 192 | echo( 193 | :: Works better in PowerShell 194 | @ECHO ON 195 | powershell ROBOCOPY C:\Users\G\Documents\Bandicam D:\Docs\Bandicam *.* /E /XJ /XO /XX /tee /r:0 /w:0 /ETA /log:C:\bandicam.log 196 | @echo off 197 | echo( 198 | echo =============================================================================== 199 | echo Test Complete! 200 | echo( 201 | pause 202 | GOTO END 203 | 204 | :END 205 | ENDLOCAL 206 | exit 207 | -------------------------------------------------------------------------------- /Get-WiFipasswords.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ::SETLOCAL 3 | SETLOCAL EnableDelayedExpansion 4 | 5 | ::Index: 6 | :: 1. :RunAsAdministrator 7 | :: 2. :Header 8 | :: 3. :Main 9 | :: 4. :Footer 10 | 11 | REM Bugfix: Use "REM ECHO DEBUG*ING: " instead of "::ECHO DEBUG*ING: " to comment-out debugging lines, in case any are within IF statements. 12 | REM ECHO DEBUGGING: Begin RunAsAdministrator block. 13 | 14 | :RunAsAdministrator 15 | :: SS64 Run with elevated permissions script (ElevateMe.vbs) 16 | :: Thanks to: http://ss64.com/vb/syntax-elevate.html 17 | :------------------------------------------------------------------------------- 18 | :: First check if we are running As Admin/Elevated 19 | FSUTIL dirty query %SystemDrive% >nul 20 | IF %ERRORLEVEL% EQU 0 GOTO START 21 | 22 | GOTO START & REM <-- Leave this line in to always skip Elevation Prompt --> 23 | ::GOTO NOCHOICE & REM <-- Leave this line in to always Elevate to Administrator (skip choice) --> 24 | ECHO: 25 | ECHO CHOICE Loading... 26 | ECHO: 27 | :: https://ss64.com/nt/choice.html 28 | CHOICE /M "Run as Administrator?" 29 | IF ERRORLEVEL 2 GOTO START & REM No. 30 | IF ERRORLEVEL 1 REM Yes. 31 | :NOCHOICE 32 | 33 | :: wait 2 seconds, in case this user is not in Administrators group. (To prevent an infinite loop of UAC admin requests on a restricted user account.) 34 | ECHO Requesting administrative privileges... ^(waiting 2 seconds^) 35 | PING -n 3 127.0.0.1 > nul 36 | 37 | ::Create and run a temporary VBScript to elevate this batch file 38 | :: https://ss64.com/nt/syntax-args.html 39 | SET _batchFile=%~s0 40 | SET _batchFile=%~f0 41 | SET _Args=%* 42 | IF NOT [%_Args%]==[] ( 43 | REM double up any quotes 44 | REM https://ss64.com/nt/syntax-replace.html 45 | SET "_Args=%_Args:"=""%" 46 | REM Bugfix: cannot use :: for comments within IF statement, instead use REM 47 | ) 48 | :: https://ss64.com/nt/if.html 49 | IF ["%_Args%"] EQU [""] ( 50 | SET "_CMD_RUN=%_batchFile%" 51 | ) ELSE ( 52 | SET "_CMD_RUN=""%_batchFile%"" %_Args%" 53 | ) 54 | :: https://ss64.com/vb/shellexecute.html 55 | ECHO Set UAC = CreateObject^("Shell.Application"^) > "%Temp%\~ElevateMe.vbs" 56 | ECHO UAC.ShellExecute "CMD", "/C ""%_CMD_RUN%""", "", "RUNAS", 1 >> "%Temp%\~ElevateMe.vbs" 57 | :: ECHO UAC.ShellExecute "CMD", "/K ""%_batchFile% %_Args%""", "", "RUNAS", 1 >> "%temp%\~ElevateMe.vbs" 58 | 59 | cscript "%Temp%\~ElevateMe.vbs" 60 | EXIT /B 61 | 62 | :START 63 | :: set the current directory to the batch file location 64 | ::CD /D %~dp0 65 | :------------------------------------------------------------------------------- 66 | :: End Run-As-Administrator function 67 | 68 | :Header 69 | GOTO SkipHeader & REM Un-comment this line to skip Header 70 | CLS 71 | ECHO: 72 | ECHO Script name ^( %~nx0 ^) & REM This script's file name and extension. https://ss64.com/nt/syntax-args.html 73 | ECHO Working directory: %~dp0 & REM The drive letter and path of this script's location. NOTE: This will always return the path this script is in. 74 | ECHO Current directory: %CD% & REM The path of the currently selected directory. NOTE: If this script is called from another location, this will return that selected path. 75 | ECHO: 76 | 77 | :: Check if we are running As Admin/Elevated 78 | FSUTIL dirty query %SystemDrive% >nul 79 | IF %ERRORLEVEL% EQU 0 ( 80 | ECHO Elevated Permissions: YES 81 | ) ELSE ( 82 | ECHO Elevated Permissions: NO 83 | REM ------------------------------------------------------------------------------- 84 | REM Bugfix: cannot use :: for comments within IF statement, instead use REM 85 | REM Bugfix: cannot use ECHO( for newlines within IF statement, instead use ECHO. or ECHO: 86 | ) 87 | 88 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 89 | REM Bugfix: Check if we have admin rights right now (even tho we may not need them), so that later functions can check the result without requiring EnableDelayedExpansion to be enabled. 90 | REM ECHO DEBUGGING: _GOT_ADMIN = '%_GOT_ADMIN%' 91 | ::https://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights 92 | NET SESSION >nul 2>&1 && SET "_GOT_ADMIN=YES" 93 | NET SESSION >nul 2>&1 || SET "_GOT_ADMIN=NO" 94 | REM ECHO DEBUGGING: _GOT_ADMIN = '%_GOT_ADMIN%' 95 | ::- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 96 | 97 | ECHO: 98 | ECHO Input parameters [%1] [%2] [%3] ... 99 | ECHO: 100 | ::PAUSE 101 | ::CLS 102 | :SkipHeader 103 | 104 | :: End Header 105 | 106 | REM ------------------------------------------------------------------------------- 107 | REM =============================================================================== 108 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 109 | :Main 110 | 111 | REM ECHO DEBUGGING: Beginning Main execution block. 112 | 113 | ::Index of Main: 114 | 115 | ::=============================================================================== 116 | :: Phase 1: Show WLAN profiles, and get which name (SSID) to use 117 | :: Phase 2: Get WLAN profile Key (passowrd) for SSID 118 | :: Phase 3: Check if command success 119 | :: Phase 4: Check if command failure 120 | ::=============================================================================== 121 | 122 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 123 | 124 | ::=============================================================================== 125 | :: Phase 1: Show WLAN profiles, and get which name to use 126 | ::=============================================================================== 127 | 128 | CLS 129 | ::ECHO Get stored Wifi password from SSID: 130 | 131 | netsh wlan show profile 132 | 133 | SET /P "_SSID=Enter SSID name: " 134 | 135 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 136 | 137 | ::=============================================================================== 138 | :: Phase 2: Get WLAN profile Key (passowrd) for SSID 139 | ::=============================================================================== 140 | 141 | IF EXIST "%_TEXT_OUTPUT_FILE%" DEL /Q "%_TEXT_OUTPUT_FILE%" & REM Clean-up temp file ASAP. 142 | IF EXIST "%_ERROR_OUTPUT_FILE%" DEL /Q "%_ERROR_OUTPUT_FILE%" & REM Clean-up temp file ASAP. 143 | 144 | SET "_TEXT_OUTPUT_FILE=%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.txt" 145 | SET "_ERROR_OUTPUT_FILE=%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.txt" 146 | 147 | netsh wlan show profile "%_SSID%" key=clear >"%_TEXT_OUTPUT_FILE%" 2>"%_ERROR_OUTPUT_FILE%" 148 | 149 | netsh wlan show profile "%_SSID%" key=clear && SET "_COMMAND_EXIT=SUCCESS" || SET "_COMMAND_EXIT=FAILURE" 150 | REM ECHO DEBUGGING: %%_COMMAND_EXIT%% = %_COMMAND_EXIT% 151 | 152 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 153 | 154 | ::=============================================================================== 155 | :: Phase 3: Check if command success 156 | ::=============================================================================== 157 | 158 | IF "%_COMMAND_EXIT%"=="SUCCESS" ( 159 | REM If command succeeds: 160 | REM ECHO DEBUGGING: Command succeeded^^! 161 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 162 | TYPE "%_TEXT_OUTPUT_FILE%" | FIND "Key Content" 163 | REM ECHO DEBUGGING: ErrorLevel = !ERRORLEVEL! 164 | IF !ERRORLEVEL! NEQ 0 ECHO No password found. 165 | 166 | REM FIND "Key Content" <"%_TEXT_OUTPUT_FILE%" 167 | REM ECHO DEBUGGING: ErrorLevel = !ERRORLEVEL! 168 | REM IF !ERRORLEVEL! NEQ 0 ECHO No password found. 169 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 170 | DEL /Q "%_TEXT_OUTPUT_FILE%" & REM Clean-up temp file ASAP. 171 | ) 172 | IF EXIST "%_TEXT_OUTPUT_FILE%" DEL /Q "%_TEXT_OUTPUT_FILE%" & REM Clean-up temp file ASAP. 173 | 174 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175 | 176 | ::=============================================================================== 177 | :: Phase 4: Check if command failure 178 | ::=============================================================================== 179 | 180 | REM Bugfix: always include "tokens=*" to handle filenames with spaces. 181 | SET "_FILE_SIZE=" 182 | FOR /F "tokens=*" %%G IN ("%_ERROR_OUTPUT_FILE%") DO SET "_FILE_SIZE=%%~zG" 183 | REM ECHO DEBUGGING: "%%_FILE_SIZE%%" = "%_FILE_SIZE%" 184 | 185 | IF "%_COMMAND_EXIT%"=="FAILURE" ( 186 | REM If command fails: 187 | REM ECHO DEBUGGING: Command failed^^! 188 | ECHO: 189 | IF %_FILE_SIZE% GTR 0 ( 190 | ECHO Error output text: 191 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 192 | TYPE "%_ERROR_OUTPUT_FILE%" 193 | ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 194 | ECHO: 195 | ) ELSE ( 196 | REM ECHO DEBUGGING: No error msg found. 197 | ) 198 | DEL /Q "%_ERROR_OUTPUT_FILE%" & REM Clean-up temp file ASAP. 199 | PAUSE 200 | GOTO Main 201 | ) 202 | IF EXIST "%_TEXT_OUTPUT_FILE%" DEL /Q "%_TEXT_OUTPUT_FILE%" & REM Clean-up temp file ASAP. 203 | IF EXIST "%_ERROR_OUTPUT_FILE%" DEL /Q "%_ERROR_OUTPUT_FILE%" & REM Clean-up temp file ASAP. 204 | 205 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 206 | 207 | ::ECHO: 208 | ::ECHO ------------------------------------------------------------------------------- 209 | 210 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 211 | 212 | :: End Main 213 | 214 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 215 | REM =============================================================================== 216 | REM ------------------------------------------------------------------------------- 217 | 218 | :Footer 219 | :END 220 | ENDLOCAL 221 | ECHO: 222 | ECHO End %~nx0 223 | ECHO: 224 | PAUSE 225 | ::GOTO :EOF 226 | EXIT /B & REM If you call this program from the command line and want it to return to CMD instead of closing Command Prompt, need to use EXIT /B or no EXIT command at all. 227 | 228 | 229 | -------------------------------------------------------------------------------- /functions/splash/demon-ascii-art.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | REM ------------------------------------------------------------------------------- 5 | REM =============================================================================== 6 | REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7 | 8 | 9 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 | # ======================================================================================================================= 11 | # ----------------------------------------------------------------------------------------------------------------------- 12 | 13 | http://ascii.co.uk/art/demon 14 | 15 | ( ) 16 | |\ _,--------._ / | 17 | | `.,' `. / | 18 | ` ' ,-' ' 19 | \/_ _ ( / 20 | (,-.`. ,',-.`. `__,' 21 | |/#\ ),-','#\`= ,'.` | 22 | `._/) -'.\_,' ) ))| 23 | / (_.)\ . -'// 24 | ( /\____/\ ) )`'\ 25 | \ |V----V|| ' , \ 26 | |`- -- -' ,' \ \ _____ 27 | ___ | .' \ \ `._,-' `- 28 | `.__,`---^---' \ ` -' 29 | -.______ \ . / ______,- 30 | `. ,' ap 31 | 32 | 33 | # ----------------------------------------------------------------------------------------------------------------------- 34 | 35 | 36 | http://ascii.co.uk/art/demon 37 | 38 | (_( 39 | ('') 40 | _ "\ )>,_ .--> 41 | _>--w/((_ >,_.' 42 | /// 43 | "`" -Naughty 44 | 45 | 46 | 47 | 48 | # ----------------------------------------------------------------------------------------------------------------------- 49 | 50 | 51 | https://www.asciiart.eu/mythology/devils 52 | 53 | 54 | .-._ _,-, 55 | `._`-._ _,-'_,' 56 | `._ `-._ _,-' _,' 57 | `._ `-._ __.-----.__ _,-' _,' 58 | `._ `#===""" """===#' _,' 59 | `._/) ._ _. (\_,' 60 | )*' **.__ __.** '*( 61 | # .==..__ "" "" __..==, # 62 | Deelkar # `"._(_). .(_)_."' # 63 | 64 | 65 | # ----------------------------------------------------------------------------------------------------------------------- 66 | 67 | https://www.asciiart.eu/mythology/devils 68 | 69 | 70 | 71 | ,-. 72 | ___,---.__ /'|`\ __,---,___ 73 | ,-' \` `-.____,-' | `-.____,-' // `-. 74 | ,' | ~'\ /`~ | `. 75 | / ___// `. ,' , , \___ \ 76 | | ,-' `-.__ _ | , __,-' `-. | 77 | | / /\_ ` . | , _/\ \ | 78 | \ | \ \`-.___ \ | / ___,-'/ / | / 79 | \ \ | `._ `\\ | //' _,' | / / 80 | `-.\ /' _ `---'' , . ``---' _ `\ /,-' 81 | `` / \ ,='/ \`=. / \ '' 82 | |__ /|\_,--.,-.--,--._/|\ __| 83 | / `./ \\`\ | | | /,//' \,' \ 84 | eViL / / ||--+--|--+-/-| \ \ 85 | | | /'\_\_\ | /_/_/`\ | | 86 | \ \__, \_ `~' _/ .__/ / 87 | `-._,-' `-._______,-' `-._,-' 88 | 89 | ,-. 90 | ___,---.__ /'|`\ __,---,___ 91 | ,-' \` `-.____,-' | `-.____,-' // `-. 92 | ,' | ~'\ /`~ | `. 93 | / ___// `. ,' , , \___ \ 94 | | ,-' `-.__ _ | , __,-' `-. | 95 | | / /\_ ` . | , _/\ \ | 96 | \ | \ \`-.___ \ | / ___,-'/ / | / 97 | \ \ | `._ `\\ | //' _,' | / / 98 | `-.\ /' _ `---'' , . ``---' _ `\ /,-' 99 | `` / \ ,='/ \`=. / \ '' 100 | |__ /|\_,--.,-.--,--._/|\ __| 101 | / `./ \\`\ | | | /,//' \,' \ 102 | eViL / / ||--+--|--+-/-| \ \ 103 | | | /'\_\_\ | /_/_/`\ | | 104 | \ \__, \_ `~' _/ .__/ / 105 | `-._,-' `-._______,-' `-._,-' 106 | 107 | 108 | # ----------------------------------------------------------------------------------------------------------------------- 109 | 110 | 111 | https://www.asciiart.eu/mythology/devils 112 | 113 | 114 | .:' `:. 115 | ::' `:: 116 | :: :. .: :: 117 | `:. `:. . .:' .:' 118 | `::. `:: ! ::' .::' 119 | `::.`::. .' ! `. .::'.::' 120 | `:. `::::'':!:``::::' ::' 121 | :'*:::. .:' ! `:. .:::*`: 122 | :: HHH::. ` ! ' .::HHH :: 123 | ::: `H TH::. `!' .::HT H' ::: 124 | ::.. `THHH:`: :':HHHT' ..:: 125 | `:: `T: `. .' :T' ::' 126 | `:. . : : . .:' 127 | `::' `::' 128 | :' .`. . .'. `: 129 | :' ::. .:: `: 130 | :' `::: :::' `: 131 | `. `` '' .' 132 | :`...........': 133 | ` :`. .': ' 134 | `: `"""' :' Ronald Allan Stanions 135 | 136 | # ----------------------------------------------------------------------------------------------------------------------- 137 | 138 | 139 | https://www.asciiart.eu/mythology/devils 140 | 141 | 142 | ._ , 143 | (`).. ,.-') 144 | (',.)-.. ,.-(..`) 145 | (,.' ,.)-.. ,.-(. `.. ) 146 | (,.' ..' .)-.. ,.-( `.. `.. ) 147 | (,.' ,.' ..')-. ,.-( `. `.. `.. ) 148 | (,.' ,.' ,.' )-.-(' `. `.. `.. ) 149 | ( ,.' ,.' _== ==_ `.. `.. ) 150 | ( ,.' _==' ~ ~ `==_ `.. ) 151 | \ _==' ----..---- `==_ ) 152 | ,.-: ,----___. .___----. -.. 153 | ,.-' ( _--====_ \/ _====--_ ) `-.. 154 | ,.-' .__.'`. `-_I0_-' `-_0I_-' .'`.__. `-.. 155 | ,.-'.' .' ( | | ) `. `.-.. 156 | ,.-' : `___--- '`.__. / __ \ .__.' `---___' : `-.. 157 | -'_________`-____________'__ \ (O) (O) / __`____________-'________`- 158 | \ . _ __ _ . / 159 | \ `V-' `-V' | 160 | | \ \ | / / 161 | V \ ~| ~/V 162 | | \ /| 163 | \~ | V - JGG 164 | \ | 165 | VV 166 | 167 | # ----------------------------------------------------------------------------------------------------------------------- 168 | 169 | http://ascii.co.uk/art/devil 170 | 171 | . . 172 | |\ |\ 173 | _..;|;__;|; 174 | ,' ';` \';`-. 175 | 7;-.. : ) 176 | .--._)| `;==,|,==' 177 | `\`@; \_ `<`G," G). 178 | `\/-;,( ) .>. ) 179 | < ,-;'-.__.;' 180 | `\_ `-,__,' 181 | kg `-..,;,> 182 | `;;;; 183 | ` ` 184 | 185 | 186 | 187 | # ----------------------------------------------------------------------------------------------------------------------- 188 | 189 | https://asciiart.website/index.php?art=creatures/devils 190 | 191 | 192 | /( )` 193 | \ \___ / | 194 | /- _ `-/ ' 195 | (/\/ \ \ /\ 196 | / / | ` \ 197 | O O ) / | 198 | `-^--'`< ' 199 | (_.) _ ) / 200 | `.___/` / 201 | `-----' / 202 | <----. __ / __ \ 203 | <----|====O)))==) \) /==== 204 | <----' `--' `.__,' \ 205 | | | 206 | \ / 207 | ______( (_ / \______ 208 | (FL) ,' ,-----' | \ 209 | `--{__________) \/ "Berkeley Unix Daemon" 210 | 211 | 212 | # ----------------------------------------------------------------------------------------------------------------------- 213 | 214 | 215 | # ----------------------------------------------------------------------------------------------------------------------- 216 | 217 | 218 | # ----------------------------------------------------------------------------------------------------------------------- 219 | 220 | 221 | # ----------------------------------------------------------------------------------------------------------------------- 222 | 223 | 224 | # ----------------------------------------------------------------------------------------------------------------------- 225 | 226 | 227 | # ----------------------------------------------------------------------------------------------------------------------- 228 | 229 | 230 | # ----------------------------------------------------------------------------------------------------------------------- 231 | 232 | 233 | # ----------------------------------------------------------------------------------------------------------------------- 234 | 235 | 236 | 237 | 238 | 239 | -------------------------------------------------------------------------------- /functions/matrix-timer.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ::COLOR 0A 3 | COLOR 2 4 | SET "_WAIT_SECONDS=%~1" 5 | IF "%~1"=="" SET "_WAIT_SECONDS=2" & REM Time in seconds, defaults to 2 6 | SET /A "_TARGET=%_WAIT_SECONDS%*80" 7 | SET "_TIMER=0" 8 | CALL :GetWindowsVersion 9 | SET "_START_TIME=%TIME%" 10 | SET "_START_DATE=%DATE%" 11 | 12 | :START 13 | IF "%_WindowsVersion%"=="10" ( 14 | ECHO %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% 15 | ) ELSE ( 16 | ECHO %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% %RANDOM% 17 | ) 18 | SET /A "_TIMER+=1" 19 | REM IF %_TIMER% GTR %_TARGET% GOTO Measure 20 | IF %_TIMER% GTR %_TARGET% GOTO END 21 | GOTO START 22 | 23 | :Measure 24 | SET "_END_TIME=%TIME%" 25 | SET "_END_DATE=%DATE%" 26 | ECHO: 27 | ECHO _WAIT_SECONDS = %_WAIT_SECONDS% 28 | ECHO _TARGET = %_TARGET% 29 | ECHO _START_TIME = %_START_TIME% 30 | ECHO _END_TIME = %_END_TIME% 31 | CALL :ConvertTimeToSeconds "%_START_TIME%" 32 | SET "_START_TIME_SECS=%_TIME_SECONDS%" 33 | CALL :ConvertTimeToSeconds "%_END_TIME%" 34 | SET "_END_TIME_SECS=%_TIME_SECONDS%" 35 | IF NOT "%_START_DATE%"=="%_END_DATE%" ( 36 | REM ECHO Next day^! 37 | REM PAUSE 38 | SET /A "_TIME_DIFF=86400-%_START_TIME_SECS%" 39 | SET /A "_TIME_DIFF+=%_END_TIME_SECS%" 40 | ) ELSE ( 41 | SET /A "_TIME_DIFF=%_END_TIME_SECS%-%_START_TIME_SECS%" 42 | ) 43 | ::SET /A "_TIME_DIFF+=3600" & REM +60 mins 44 | ::SET /A "_TIME_DIFF+=4200" & REM +70 mins (1 hr 10 mins) 45 | ::SET /A "_TIME_DIFF+=86400" & REM +24 hrs 46 | CALL :ConvertSecondsToTime "%_TIME_DIFF%" 47 | ECHO Duration = %_TIME_FORMATTED% 48 | ECHO Duration = %_TIME_DURATION% 49 | SET /A "_TARGET_DIV_100=%_TARGET%/100" 50 | ECHO _WAIT_SECONDS = %_WAIT_SECONDS% sec 51 | ECHO _TARGET/100 = %_TARGET_DIV_100% 52 | SET "_LOG=%~dpn0.csv" & REM This script's Drive letter, file Path, and file Name. https://ss64.com/nt/syntax-args.html 53 | IF NOT EXIST "%_LOG%" ECHO _TARGET,_TIME_IN_SECONDS> "%_LOG%" 54 | ECHO %_TARGET%,%_TIME_DIFF% >>"%_LOG%" 55 | ECHO: 56 | PAUSE 57 | 58 | :END 59 | EXIT /B & REM If you call this program from the command line and want it to return to CMD instead of closing Command Prompt, need to use EXIT /B or no EXIT command at all. 60 | 61 | REM ------------------------------------------------------------------------------- 62 | 63 | :DefineFunctions 64 | :: Declare Functions 65 | 66 | ::Index of functions: 67 | :: 1. :GetWindowsVersion 68 | :: 2. :ConvertTimeToSeconds 69 | :: 3. :ConvertSecondsToTime 70 | 71 | GOTO SkipFunctions 72 | :------------------------------------------------------------------------------- 73 | :GetWindowsVersion 74 | @ECHO OFF 75 | SETLOCAL 76 | FOR /F "tokens=4-7 delims=[.] " %%i IN ('ver') DO ( 77 | IF %%i == Version SET "_winversion=%%j.%%k" 78 | IF %%i neq Version SET "_winversion=%%i.%%j" 79 | ) 80 | IF "%_winversion%" == "10.0" ( 81 | SET "_winversion=10" 82 | SET "_winvername=10" 83 | SET "_easyname=Windows 10" 84 | ECHO Windows 10 85 | ) ELSE ( 86 | IF "%_winversion%" == "6.3" ( 87 | SET "_winvername=8.1" 88 | SET "_easyname=Windows 8.1" 89 | ECHO Windows 8.1 90 | ) ELSE ( 91 | IF "%_winversion%" == "6.2" ( 92 | SET "_winvername=8" 93 | SET "_easyname=Windows 8" 94 | ECHO Windows 8 95 | ) ELSE ( 96 | IF "%_winversion%" == "6.1" ( 97 | SET "_winvername=7" 98 | SET "_easyname=Windows 7" 99 | ECHO Windows 7 100 | ) ELSE ( 101 | IF "%_winversion%" == "6.0" ( 102 | SET "_winvername=Vista" 103 | SET "_easyname=Windows Vista" 104 | ECHO Windows Vista 105 | ) ELSE ( 106 | IF "%_winversion%" == "5.2" ( 107 | SET "_winvername=Server 2003 / R2 / XP 64-bit" 108 | SET "_easyname=Windows Server 2003 / R2 / Windows XP 64-bit Edition" 109 | ECHO Windows Server 2003 / R2 / Windows XP 64-bit Edition 110 | ) ELSE ( 111 | IF "%_winversion%" == "5.1" ( 112 | SET "_winvername=XP" 113 | SET "_easyname=Windows XP" 114 | ECHO Windows XP 115 | ) ELSE ( 116 | IF "%_winversion%" == "5.0" ( 117 | SET "_winvername=2000" 118 | SET "_easyname=Windows 2000" 119 | ECHO Windows 2000 120 | ) ELSE ( 121 | REM SET "_winversion=0.0" 122 | SET "_winvername=Unknown" 123 | SET "_easyname=Unable to determine OS version automatically: %_winversion%" 124 | ECHO %_easyname% 125 | ) 126 | ) 127 | ) 128 | ) 129 | ) 130 | ) 131 | ) 132 | ) 133 | ENDLOCAL & SET "_WindowsVersion=%_winversion%" & SET "_WindowsName=%_winvername%" & SET "_WindowsEasyName=%_easyname%" 134 | EXIT /B 135 | :------------------------------------------------------------------------------- 136 | :ConvertTimeToSeconds TimeValue [/D] 137 | :: Takes a given 24-hour time input like " 5:47:23.52" or "21-31-39" and converts it into seconds 138 | :: /D Include decimal calculations. If this switch is omitted any decimal values passed will be dropped. 139 | :: Output: %_TIME_SECONDS% 140 | @ECHO OFF 141 | SETLOCAL 142 | SET "_INPUT_TIME=%~1" 143 | SET "_SEC_SWITCH=%~2" 144 | :: https://ss64.com/nt/syntax-substring.html 145 | :: Extract Hours (first 2 digits) 146 | SET "_TIME_HOURS=%_INPUT_TIME:~0,2%" 147 | :: Bugfix: Check if first digit in hours is a zero (e.g. 09) or blank 148 | :: Extract the first character out of _TIME_HOURS 149 | SET "_TIME_HOURS_FIRST=%_TIME_HOURS:~0,1%" 150 | IF "%_TIME_HOURS_FIRST%"==" " ( 151 | REM Set _TIME_HOURS to the second character (instead of first 2 digits of string) 152 | SET "_TIME_HOURS=%_INPUT_TIME:~1,1%" 153 | ) ELSE ( 154 | IF "%_TIME_HOURS_FIRST%"=="0" ( 155 | REM Bugfix: Cannot use ' IF %_TIME_HOURS_FIRST% EQU 0 ' since if the first character is a space, it will still fail with "0 was unexpected at this time." Must do a string compare. 156 | REM Set _TIME_HOURS to the second character (instead of first 2 digits of string) 157 | SET "_TIME_HOURS=%_INPUT_TIME:~1,1%" 158 | ) 159 | ) 160 | ::ECHO Hour = %_TIME_HOURS% 161 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 162 | :: Extract Minutes (4th and 5th character) 163 | SET "_TIME_MINS=%_INPUT_TIME:~3,2%" 164 | :: Bugfix: Check if first digit in minutes is a zero (e.g. 09) 165 | :: Extract the first character out of _TIME_MINS 166 | SET "_TIME_MINS_FIRST=%_TIME_MINS:~0,1%" 167 | IF %_TIME_MINS_FIRST% EQU 0 ( 168 | REM Set _TIME_MINS to the 5th character, rather than the 4th and 5th characters 169 | SET "_TIME_MINS=%_INPUT_TIME:~4,1%" 170 | ) 171 | ::ECHO Mins = %_TIME_MINS% 172 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 173 | :: Extract Seconds (7th and 8th characters) 174 | SET "_TIME_SECS=%_INPUT_TIME:~6,2%" 175 | :: Bugfix: Check if first digit in seconds is a zero (e.g. 09) 176 | :: Extract the first character out of _TIME_SECS 177 | SET "_TIME_SECS_FIRST=%_TIME_SECS:~0,1%" 178 | IF %_TIME_SECS_FIRST% EQU 0 ( 179 | REM Extract the 8th character 180 | SET "_TIME_SECS=%_INPUT_TIME:~7,1%" 181 | ) 182 | ::ECHO Secs = %_TIME_SECS% 183 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 184 | :: Make hours into minutes (multiply by 60) 185 | SET /A "_TIME_HOURS_MINS=%_TIME_HOURS%*60" 186 | :: Add to minutes 187 | SET /A "_TIME_MINS+=%_TIME_HOURS_MINS%" 188 | :: Make minutes into seconds (multiply by 60) 189 | SET /A "_TIME_MINS_SECS=%_TIME_MINS%*60" 190 | :: Add to seconds 191 | SET /A "_TIME_SECS+=%_TIME_MINS_SECS%" 192 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 193 | SET "_SWITCH_LETTER=%_SEC_SWITCH:~1,1%" 194 | IF /I "%_SWITCH_LETTER%"=="D" ( 195 | REM Extract Seconds (everything after the 8th character) 196 | SET "_TIME_MILISECS=%_INPUT_TIME:~8%" 197 | REM Appends everything extracted (fractions of a second) to the end of our final seconds calculation. 198 | SET "_TIME_SECS=%_TIME_MINS_SECS%%_TIME_MILISECS%" 199 | ) 200 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201 | ENDLOCAL & SET "_TIME_SECONDS=%_TIME_SECS%" 202 | EXIT /B 203 | :------------------------------------------------------------------------------- 204 | :ConvertSecondsToTime TimeValInSeconds 205 | :: Takes a value given in seconds and converts it into several time formats 206 | :: Outputs: 207 | :: "%_TIME_FORMATTED%" (will always be exactly 8 characters long) e.g. " 9:31:39" 208 | :: "%_TIME_SORTABLE%" (will always be exactly 8 characters long) e.g. "09-31-39" 209 | :: "%_TIME_DURATION%" (will always be exactly 12 characters long) e.g. " 9h 31m 39s" or "109h 7m 9s" 210 | @ECHO OFF 211 | SETLOCAL 212 | SET "_INPUT_SECS=%~1" 213 | :: https://ss64.com/nt/set.html 214 | :: Get minutes from seconds 215 | SET /A "_TIME_MINS=%_INPUT_SECS%/60" 216 | :: Keep the remainder as seconds 217 | SET /A "_TIME_SECS=%_INPUT_SECS%%%60" 218 | :: Get hours from minutes 219 | SET /A "_TIME_HOURS=%_TIME_MINS%/60" 220 | :: Keep the remainder as minutes 221 | SET /A "_TIME_MINS%%=60" 222 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223 | :: Format time like " 9:31:39" (FORMATTED) 224 | IF %_TIME_HOURS% LSS 10 (SET "_FORM_HOURS= %_TIME_HOURS%") ELSE (SET "_FORM_HOURS=%_TIME_HOURS%") 225 | IF %_TIME_MINS% LSS 10 (SET "_FORM_MINS=0%_TIME_MINS%") ELSE (SET "_FORM_MINS=%_TIME_MINS%") 226 | IF %_TIME_SECS% LSS 10 (SET "_FORM_SECS=0%_TIME_SECS%") ELSE (SET "_FORM_SECS=%_TIME_SECS%") 227 | SET "_FORM_TIME=%_FORM_HOURS%:%_FORM_MINS%:%_FORM_SECS%" 228 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 229 | :: Format time like "09-31-39" (SORTABLE) 230 | IF %_TIME_HOURS% LSS 10 (SET "_SORT_HOURS=0%_TIME_HOURS%") ELSE (SET "_SORT_HOURS=%_TIME_HOURS%") 231 | IF %_TIME_MINS% LSS 10 (SET "_SORT_MINS=0%_TIME_MINS%") ELSE (SET "_SORT_MINS=%_TIME_MINS%") 232 | IF %_TIME_SECS% LSS 10 (SET "_SORT_SECS=0%_TIME_SECS%") ELSE (SET "_SORT_SECS=%_TIME_SECS%") 233 | SET "_SORT_TIME=%_SORT_HOURS%-%_SORT_MINS%-%_SORT_SECS%" 234 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 235 | :: Format time like " 9h 31m 39s" (DURATION) 236 | IF %_TIME_HOURS% LSS 100 (SET "_DUR_HOURS= %_TIME_HOURS%") ELSE (SET "_DUR_HOURS=%_TIME_HOURS%") 237 | IF %_TIME_HOURS% LSS 10 (SET "_DUR_HOURS= %_DUR_HOURS%") ELSE (SET "_DUR_HOURS=%_DUR_HOURS%") 238 | IF %_TIME_MINS% LSS 10 (SET "_DUR_MINS= %_TIME_MINS%") ELSE (SET "_DUR_MINS=%_TIME_MINS%") 239 | IF %_TIME_SECS% LSS 10 (SET "_DUR_SECS= %_TIME_SECS%") ELSE (SET "_DUR_SECS=%_TIME_SECS%") 240 | SET "_DUR_TIME=%_DUR_HOURS%h %_DUR_MINS%m %_DUR_SECS%s" 241 | :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 242 | ENDLOCAL & SET "_TIME_FORMATTED=%_FORM_TIME%" & SET "_TIME_SORTABLE=%_SORT_TIME%" & SET "_TIME_DURATION=%_DUR_TIME%" 243 | EXIT /B 244 | :------------------------------------------------------------------------------- 245 | :: End functions 246 | :SkipFunctions 247 | -------------------------------------------------------------------------------- /Backup and Restore/Transferring Files/Robocopy/Parsing ROBOCOPY logs.txt: -------------------------------------------------------------------------------- 1 | 2 | # Parsing ROBOCOPY logs 3 | ----------------------- 4 | 5 | Sample Error log: 6 | ----------------- 7 | 8 | Settings: 2 retrys, 30 second wait 9 | 10 | 11 | :------------------------------------------------------------------------------- 12 | 13 | 1 F:\MediaShare\Music\+Classical\ 14 | 7 F:\MediaShare\Music\+Classical\Mysterious\ 15 | 13 F:\MediaShare\Music\+Classical\Powerful\ 16 | 0 F:\MediaShare\Music\+Classical\Powerful\TCHAIKOVSKY, Pyotr Ilyich - Symphony No 6 'Pathetique'\ 17 | 1 F:\MediaShare\Music\+Classical\Rousing\ 18 | 1 F:\MediaShare\Music\+Classical\Whimsical\ 19 | 22 F:\MediaShare\Music\+Playlists\ 20 | 19 F:\MediaShare\Music\+Playlists\OneNote Playlists\ 21 | 14 F:\MediaShare\Music\+Playlists\WPL Playlists\ 22 | 0 F:\MediaShare\Music\+PlaylistsMedia\ 23 | 1 F:\MediaShare\Music\+PlaylistsMedia\Alice\ 24 | 13 F:\MediaShare\Music\+PlaylistsMedia\Alice\Infected Mushroom\ 25 | 2 F:\MediaShare\Music\+PlaylistsMedia\Alice\The Avalanches\ 26 | 23 F:\MediaShare\Music\+PlaylistsMedia\Alice\The Avalanches\Since I Left You\ 27 | 186 F:\MediaShare\Music\+PlaylistsMedia\Christmas\ 28 | New File 7.2 m Mariah Carey-All I Want For Christmas Is You(Sony BMG)(2004)(BPM 75).mp3 29 | 0.0% 30 | 6.8% 31 | 13.7% 32 | 20.5% 33 | 27.4% 34 | 34.2% 35 | 41.1% 36 | 2018/01/10 01:57:17 ERROR 1117 (0x0000045D) Copying File F:\MediaShare\Music\+PlaylistsMedia\Christmas\Mariah Carey-All I Want For Christmas Is You(Sony BMG)(2004)(BPM 75).mp3 37 | The request could not be performed because of an I/O device error. 38 | 39 | Waiting 30 seconds... Retrying... 40 | New File 7.2 m Mariah Carey-All I Want For Christmas Is You(Sony BMG)(2004)(BPM 75).mp3 41 | 0.0% 42 | 6.8% 43 | 13.7% 44 | 20.5% 45 | 27.4% 46 | 34.2% 47 | 41.1% 48 | 2018/01/10 01:58:43 ERROR 1117 (0x0000045D) Copying File F:\MediaShare\Music\+PlaylistsMedia\Christmas\Mariah Carey-All I Want For Christmas Is You(Sony BMG)(2004)(BPM 75).mp3 49 | The request could not be performed because of an I/O device error. 50 | 51 | Waiting 30 seconds... Retrying... 52 | New File 7.2 m Mariah Carey-All I Want For Christmas Is You(Sony BMG)(2004)(BPM 75).mp3 53 | 0.0% 54 | 6.8% 55 | 13.7% 56 | 20.5% 57 | 27.4% 58 | 34.2% 59 | 41.1% 60 | 2018/01/10 02:00:08 ERROR 1117 (0x0000045D) Copying File F:\MediaShare\Music\+PlaylistsMedia\Christmas\Mariah Carey-All I Want For Christmas Is You(Sony BMG)(2004)(BPM 75).mp3 61 | The request could not be performed because of an I/O device error. 62 | 63 | 64 | ERROR: RETRY LIMIT EXCEEDED. 65 | 66 | New File 5.8 m Mary Margaret O`Hara-What Are You Doing New Years' Eve(Virgin)(1991)(BPM ).MP3 67 | 0.0% 68 | 8.5% 69 | 17.1% 70 | 25.7% 71 | 34.3% 72 | 42.9% 73 | 51.5% 74 | 60.1% 75 | 2018/01/10 02:02:12 ERROR 1117 (0x0000045D) Copying File F:\MediaShare\Music\+PlaylistsMedia\Christmas\Mary Margaret O`Hara-What Are You Doing New Years' Eve(Virgin)(1991)(BPM ).MP3 76 | The request could not be performed because of an I/O device error. 77 | 78 | Waiting 30 seconds... Retrying... 79 | New File 5.8 m Mary Margaret O`Hara-What Are You Doing New Years' Eve(Virgin)(1991)(BPM ).MP3 80 | 0.0% 81 | 8.5% 82 | 17.1% 83 | 25.7% 84 | 34.3% 85 | 42.9% 86 | 51.5% 87 | 60.1% 88 | 2018/01/10 02:03:37 ERROR 1117 (0x0000045D) Copying File F:\MediaShare\Music\+PlaylistsMedia\Christmas\Mary Margaret O`Hara-What Are You Doing New Years' Eve(Virgin)(1991)(BPM ).MP3 89 | The request could not be performed because of an I/O device error. 90 | 91 | Waiting 30 seconds... Retrying... 92 | New File 5.8 m Mary Margaret O`Hara-What Are You Doing New Years' Eve(Virgin)(1991)(BPM ).MP3 93 | 0.0% 94 | 8.5% 95 | 17.1% 96 | 25.7% 97 | 34.3% 98 | 42.9% 99 | 51.5% 100 | 60.1% 101 | 2018/01/10 02:05:03 ERROR 1117 (0x0000045D) Copying File F:\MediaShare\Music\+PlaylistsMedia\Christmas\Mary Margaret O`Hara-What Are You Doing New Years' Eve(Virgin)(1991)(BPM ).MP3 102 | The request could not be performed because of an I/O device error. 103 | 104 | 105 | ERROR: RETRY LIMIT EXCEEDED. 106 | 107 | New File 4.6 m Matt Monro-From Russia With Love(EMI)(1963).mp3 108 | 0% 109 | 10% 110 | 21% 111 | 32% 112 | 2018/01/10 02:06:59 ERROR 1117 (0x0000045D) Copying File F:\MediaShare\Music\+PlaylistsMedia\Christmas\Matt Monro-From Russia With Love(EMI)(1963).mp3 113 | The request could not be performed because of an I/O device error. 114 | 115 | Waiting 30 seconds... Retrying... 116 | New File 4.6 m Matt Monro-From Russia With Love(EMI)(1963).mp3 117 | 0% 118 | 10% 119 | 21% 120 | 32% 121 | 2018/01/10 02:08:24 ERROR 1117 (0x0000045D) Copying File F:\MediaShare\Music\+PlaylistsMedia\Christmas\Matt Monro-From Russia With Love(EMI)(1963).mp3 122 | The request could not be performed because of an I/O device error. 123 | 124 | Waiting 30 seconds... Retrying... 125 | New File 4.6 m Matt Monro-From Russia With Love(EMI)(1963).mp3 126 | 0% 127 | 10% 128 | 21% 129 | 32% 130 | 2018/01/10 02:09:50 ERROR 1117 (0x0000045D) Copying File F:\MediaShare\Music\+PlaylistsMedia\Christmas\Matt Monro-From Russia With Love(EMI)(1963).mp3 131 | The request could not be performed because of an I/O device error. 132 | 133 | 134 | ERROR: RETRY LIMIT EXCEEDED. 135 | 136 | New File 6.0 m Matt Monro-Mary's Boy Child(EMI)(1977)(BPM ).MP3 137 | 0.0% 138 | 8.2% 139 | 16.5% 140 | 24.7% 141 | 33.0% 142 | 41.3% 143 | 2018/01/10 02:12:22 ERROR 1117 (0x0000045D) Copying File F:\MediaShare\Music\+PlaylistsMedia\Christmas\Matt Monro-Mary's Boy Child(EMI)(1977)(BPM ).MP3 144 | The request could not be performed because of an I/O device error. 145 | 146 | Waiting 30 seconds... Retrying... 147 | New File 6.0 m Matt Monro-Mary's Boy Child(EMI)(1977)(BPM ).MP3 148 | 0.0% 149 | 8.2% 150 | 16.5% 151 | 24.7% 152 | 33.0% 153 | 41.3% 154 | 2018/01/10 02:13:48 ERROR 1117 (0x0000045D) Copying File F:\MediaShare\Music\+PlaylistsMedia\Christmas\Matt Monro-Mary's Boy Child(EMI)(1977)(BPM ).MP3 155 | The request could not be performed because of an I/O device error. 156 | 157 | Waiting 30 seconds... Retrying... 158 | New File 6.0 m Matt Monro-Mary's Boy Child(EMI)(1977)(BPM ).MP3 159 | 0.0% 160 | 8.2% 161 | 16.5% 162 | 24.7% 163 | 33.0% 164 | 41.3% 165 | 2018/01/10 02:15:10 ERROR 1117 (0x0000045D) Copying File F:\MediaShare\Music\+PlaylistsMedia\Christmas\Matt Monro-Mary's Boy Child(EMI)(1977)(BPM ).MP3 166 | The request could not be performed because of an I/O device error. 167 | 168 | 169 | ERROR: RETRY LIMIT EXCEEDED. 170 | 171 | 74 F:\MediaShare\Music\+PlaylistsMedia\Lucy\ 172 | 12 F:\MediaShare\Music\+PlaylistsMedia\Lucy\Golden Earring - Eight Miles High (1969)\ 173 | 15 F:\MediaShare\Music\+PlaylistsMedia\Lucy\Janis Joplin\ 174 | 1 F:\MediaShare\Music\+PlaylistsMedia\Lucy\Jefferson Airplane\ 175 | 6 F:\MediaShare\Music\+PlaylistsMedia\Lucy\Jefferson Airplane\Surrealistic Pillow (2003 Remaster)\ 176 | 26 F:\MediaShare\Music\+PlaylistsMedia\Lucy\Simon & Garfunkel\ 177 | 12 F:\MediaShare\Music\+PlaylistsMedia\Lucy\Tommy James and the Shondells\ 178 | 4 F:\MediaShare\Music\+PlaylistsMedia\Lucy\Yes\ 179 | 17 F:\MediaShare\Music\+PlaylistsMedia\Lucy\Yes\Fragile\ 180 | 56 F:\MediaShare\Music\+PlaylistsMedia\Mary Jane\ 181 | 8 F:\MediaShare\Music\+PlaylistsMedia\Mary Jane\Cypress Hill\ 182 | 23 F:\MediaShare\Music\+PlaylistsMedia\Mary Jane\Cypress Hill\Cypress Hill 1991\ 183 | 12 F:\MediaShare\Music\+PlaylistsMedia\Molly\ 184 | 5 F:\MediaShare\Music\+PlaylistsMedia\Molly\C.A.2K\ 185 | 15 F:\MediaShare\Music\+PlaylistsMedia\Molly\C.A.2K\?? ???? ????\ 186 | 1 F:\MediaShare\Music\+PlaylistsMedia\Molly\Citrik vs. Twilight\ 187 | 6 F:\MediaShare\Music\+PlaylistsMedia\Molly\Citrik vs. Twilight\1-8-2008\ 188 | 2 F:\MediaShare\Music\+PlaylistsMedia\Molly\Counterstrike\ 189 | 11 F:\MediaShare\Music\+PlaylistsMedia\Molly\Counterstrike\From Beyond The Grave\ 190 | 0 F:\MediaShare\Music\+PlaylistsMedia\Molly\DJ Noize\ 191 | 2 F:\MediaShare\Music\+PlaylistsMedia\Molly\DJ Noize\3 DECK\ 192 | 1 F:\MediaShare\Music\+PlaylistsMedia\Molly\DJ Noize\New 3 Deck Mix\ 193 | 1 F:\MediaShare\Music\+PlaylistsMedia\Molly\DJ Rex\ 194 | 1 F:\MediaShare\Music\+PlaylistsMedia\Molly\DJ Rex\BRKS\ 195 | 0 F:\MediaShare\Music\+PlaylistsMedia\Molly\Wain Johnstone\ 196 | 2 F:\MediaShare\Music\+PlaylistsMedia\Molly\Wain Johnstone\Smile\ 197 | 65 F:\MediaShare\Music\+PlaylistsMedia\PARTY Playlist\ 198 | 17 F:\MediaShare\Music\+PlaylistsMedia\PARTY Playlist\Funny\ 199 | 0 F:\MediaShare\Music\+Sound Effects\ 200 | 4 F:\MediaShare\Music\+Sound Effects\Stock Sounds\ 201 | 29 F:\MediaShare\Music\+Theme Songs\ 202 | 203 | /SAMPLE ERROR LOG 204 | 205 | :------------------------------------------------------------------------------- 206 | 207 | 208 | 209 | 210 | 211 | 212 | Sample Error log #2: 213 | -------------------- 214 | 215 | This time, after the error, the copy succeeds 216 | 217 | 218 | :------------------------------------------------------------------------------- 219 | 220 | 221 | 1 F:\MediaShare\Music\+Classical\ 222 | 7 F:\MediaShare\Music\+Classical\Mysterious\ 223 | 13 F:\MediaShare\Music\+Classical\Powerful\ 224 | 0 F:\MediaShare\Music\+Classical\Powerful\TCHAIKOVSKY, Pyotr Ilyich - Symphony No 6 'Pathetique'\ 225 | 1 F:\MediaShare\Music\+Classical\Rousing\ 226 | 1 F:\MediaShare\Music\+Classical\Whimsical\ 227 | 22 F:\MediaShare\Music\+Playlists\ 228 | 19 F:\MediaShare\Music\+Playlists\OneNote Playlists\ 229 | 14 F:\MediaShare\Music\+Playlists\WPL Playlists\ 230 | 0 F:\MediaShare\Music\+PlaylistsMedia\ 231 | 1 F:\MediaShare\Music\+PlaylistsMedia\Alice\ 232 | 13 F:\MediaShare\Music\+PlaylistsMedia\Alice\Infected Mushroom\ 233 | 2 F:\MediaShare\Music\+PlaylistsMedia\Alice\The Avalanches\ 234 | 23 F:\MediaShare\Music\+PlaylistsMedia\Alice\The Avalanches\Since I Left You\ 235 | 186 F:\MediaShare\Music\+PlaylistsMedia\Christmas\ 236 | New File 5.2 m Matt Monro-When A Child Is Born(EMI).mp3 237 | 0% 238 | 2018/01/10 01:20:12 ERROR 1117 (0x0000045D) Copying File F:\MediaShare\Music\+PlaylistsMedia\Christmas\Matt Monro-When A Child Is Born(EMI).mp3 239 | The request could not be performed because of an I/O device error. 240 | 241 | Waiting 30 seconds... Retrying... 242 | New File 5.2 m Matt Monro-When A Child Is Born(EMI).mp3 243 | 0% 244 | 9% 245 | 19% 246 | 28% 247 | 38% 248 | 47% 249 | 57% 250 | 66% 251 | 76% 252 | 85% 253 | 95% 254 | 100% 255 | New File 5.2 m Michael Buble-All I Want for Christmas Is You(WEA)(2011)(BPM 71).mp3 256 | 0% 257 | 9% 258 | 18% 259 | 28% 260 | 37% 261 | 47% 262 | 56% 263 | 66% 264 | 75% 265 | 85% 266 | 94% 267 | 100% 268 | New File 6.1 m Michael Buble-Cold December Night(WEA)(2011)(BPM 83).mp3 269 | 0.0% 270 | 8.1% 271 | 16.3% 272 | 24.5% 273 | 32.7% 274 | 40.8% 275 | 49.0% 276 | 57.2% 277 | 65.4% 278 | 73.5% 279 | 81.7% 280 | 89.9% 281 | 98.1% 282 | 100% 283 | 284 | 285 | 286 | /SAMPLE ERROR LOG 287 | 288 | :------------------------------------------------------------------------------- 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | --------------------------------------------------------------------------------