- #Imagex batch script example download#
- #Imagex batch script example free#
- #Imagex batch script example windows#
#Imagex batch script example windows#
The thing of this script that is the most revolutionary is the method it uses to create auto-reconnecting SSH-encrypted SOCKS5 tunnels using the windows SYSTEM account to do it all in the background with plink.exe. I wrote this to run automatically from a USB key so that I could keep my tools with me portably. I wanted to try and write a pure batch method to do that. It effectively creates SSH-encrypted SOCK5 tunnels that stay connected and auto-reconnect if the link goes down. This is an easier file to understand the scope of. Just added this as an after thought, moving the main example further down this page. IF ERRORLEVEL 1 CALL :PINGCHECK "%~1" ELSE EXIT /B One of the first hacks for batch files is line 1, the PUSHD command cd's the scripts working environment to the directory of the script OFF & PUSHD "%~dp0" & SETLOCAL When the server goes down the network goes down too so I fire this script up to continually ping the remote server until it responds, at which point I can ssh back in. The reboot is issued from an SSH session and causes the server to go down and then come back up. This is a simple batch file named ping-check.bat that I use when rebooting remote servers. bat and open in your IDE/text-editor of choice.
#Imagex batch script example download#
The next thing to do is download the source code, which includes comments and formatting I had to remove for this online article. Set that up and you will have a color-syntax-highlighted editor for Batch Scripting that works very very well.
#Imagex batch script example free#
bat files is the free and open-source Notepad++.
My favorite tool (and I've tried sooo many) for editing most Windows files and especially. MKILL - exit cmd processor with message %~1.MDYE - exit script with message %~1, then returns to CALLer.MP3 - ECHO %~1, speak %~1 with nircmd.exe, then returns to CALLer.MP - Print Output, then returns to CALLer.MT - prints blank line, L1, changes title of the interpreter window to %~1, prints > %~1., L2, blank line, then returns to CALLer.MM - prints blank line, L1, changes title of the interpreter window to %~1, prints > %~1., L2, blank line, then returns to CALLer.MF - SLEEPs for 1 second, then prints out completed message, followed by 2 blank lines, then returns to CALLer.LISTSERVICES - lists services, then returns to CALLer.SHUTDOWNIN - initiates shutdown, then returns to CALLer (pointless).LOCKDOWN - locks workstation, then returns to CALLer (pointless).RR - IF file %1 EXISTs then :MT "Removing %1" then :MF, then ( or IF %1 not EXISTs) returns to CALLer.EXISTORQUIT - checks %~1 exists, IF it does returns to CALLer, otherwise, quit.ADMINSHELL - sets prompt, then returns to CALLer.EXAMINEFILE - FINDs useful strings in file, then returns to CALLer.PARAMTESTHELP - show params help, then returns to CALLer.
PARAMTEST - tests params, then returns to CALLer.MSETCONSOLE - sets the cols and lines of current screen buffer, then returns to CALLer.
MSETCOLOR - SET colors for screen, then returns to CALLer.