<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bohack &#187; Script</title>
	<atom:link href="http://www.bohack.com/tag/script/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bohack.com</link>
	<description>Check In and Tune Out!</description>
	<lastBuildDate>Wed, 24 Feb 2010 18:55:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Windows Version of the Linux / UNIX &#8216;which&#8217; Command</title>
		<link>http://www.bohack.com/2008/11/windows-version-of-the-linux-which-command/</link>
		<comments>http://www.bohack.com/2008/11/windows-version-of-the-linux-which-command/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 19:38:26 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=137</guid>
		<description><![CDATA[During the day I always have a command window open on my desktop. It helps get simple tasks done; like reseting a password for a user or opening an ssh session with a remote box. I have a multitude of Windows command or cmd scripts that help me through out the day. Often I may [...]]]></description>
			<content:encoded><![CDATA[<p>During the day I always have a command window open on my desktop. It helps get simple tasks done; like reseting a password for a user or opening an ssh session with a remote box. I have a multitude of Windows command or cmd scripts that help me through out the day. Often I may want to change or tweak a script and then the hunt is on&#8230; Which directory was it created in? I know that it is in the path; because I can just execute it without typing it&#8217;s full path, but where is it?</p>
<p><span id="more-137"></span><br />
As best practice; I recommend to keep all scripts in a folder at the base of the %systemdrive% or C: drive and include it in your system %path% variable. This makes it easy to take your tools with you, when you redo your laptop or desktop. I personally use a folder called &#8216;sys&#8217;, but you can select your own. Just be sure to include the folder in your %path% variable.</p>
<p>Even if you put all your files in a particular folder sometimes your just looking for that particular file in the path. So I have written a Windows version of the UNIX &#8216;which&#8217; command. Just copy the script below and save it as &#8216;which.cmd&#8217; in your &#8216;sys&#8217; folder.</p>
<p>Copy and Paste the script below into notepad and save it as &#8220;which.cmd&#8221;</p>
<pre>
@echo off
rem /
rem / which.cmd - 110108 - bohack.com 2008iÂ Â Â Â  /
rem / Windows version of the UNIX which command /
rem /
setlocal
if [%1]==[] goto :errhand
set whichpath=%~dp$path:1
if [%whichpath%]==[] goto :end
echo %whichpath%%1
goto end

:errhand
echo.
echo Usage: %0 (filename to search in path)

:end
endlocal
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2008/11/windows-version-of-the-linux-which-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Server Ping and Reboot Monitor</title>
		<link>http://www.bohack.com/2008/11/simple-server-ping-and-reboot-monitor/</link>
		<comments>http://www.bohack.com/2008/11/simple-server-ping-and-reboot-monitor/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 01:36:54 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=131</guid>
		<description><![CDATA[I think we have all rebooted a server and then asked ourselves &#8220;Did it actually reboot?&#8221;. So we hunt through the logs for the event and then move on or reboot it again. During patch day for the servers this can be a real nag, knowing when something is back online so you can finish [...]]]></description>
			<content:encoded><![CDATA[<p>I think we have all rebooted a server and then asked ourselves &#8220;Did it actually reboot?&#8221;. So we hunt through the logs for the event and then move on or reboot it again. During patch day for the servers this can be a real nag, knowing when something is back online so you can finish patching it; is key to getting the job done. So I wrote this little batch script a while ago to help keep track.</p>
<p><span id="more-131"></span></p>
<p>Once it&#8217;s started via the command of &#8216;pingmon servername&#8217;. It will echo the time it started monitoring, then the alive time of a successful ping back. Once the host goes dead, it will echo the time it went dead or lost ping. Then it will echo the time it has gone alive again and quit. Simple batch script with one purpose, to make the administrator&#8217;s life simple.</p>
<p>Just copy and paste the script below into notepad and save it as &#8220;pingmon.cmd&#8221;</p>
<pre>@echo off

rem Bohack - pingmon.cmd - 2002i

set ipname=%1

if {%ipname%}=={} (GOTO :errhand)

set /a calive=0
set /a cdead=0
set /a cexit=0

echo.
echo.
echo Monitoring %ipname%
echo.
echo ** Started %date% - %time%
echo.

:loop

FOR /F â€œskip=3 tokens=1,2*â€ %%a IN (â€™ping -n 1 %ipname%â€™) DO CALL :checkdo %%a
if %cexit% EQU 1 (goto :mend)

goto :loop

:checkdo

set reply=%1
if {%reply%}=={} (goto :end)
set replytruc=%reply:~0,5%
if /I {%replytruc%}=={Reply} (goto :alive)
if /I {%replytruc%}=={Reque} (goto :dead)
goto :end

:alive

if %calive% EQU 0 (echo ** Alive %date% - %time%)
set /a calive=1
if %cdead% GTR 0 (echo ** Alive %date% - %time%) &amp; (set /a cexit=1)

goto :end

:dead

if %cdead% LSS 1 (echo ** DeadÂ  %date% - %time%)
set /a cdead=1

goto :end

:errhand

echo.
echo.
echo Usage PingMon {computer or IP}

:mend

echo.
echo.

:end</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2008/11/simple-server-ping-and-reboot-monitor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
