<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Some Weird DOS String Things</title>
	<atom:link href="http://www.devpicayune.com/entry/200705151708/feed" rel="self" type="application/rss+xml" />
	<link>http://www.devpicayune.com/entry/200705151708</link>
	<description>picayune: of little value or importance</description>
	<lastBuildDate>Mon, 31 May 2010 21:40:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Stephen Burke</title>
		<link>http://www.devpicayune.com/entry/200705151708/comment-page-1#comment-21778</link>
		<dc:creator>Stephen Burke</dc:creator>
		<pubDate>Fri, 27 Jun 2008 14:36:53 +0000</pubDate>
		<guid isPermaLink="false">#comment-21778</guid>
		<description>Trying to feed it a mac address via %1. Example, if the batch is nameed test.bat I would like to feed it like this:

C:\&gt;test.bat 0020E7666999

Sadly it adds anything I throw at it into the file no matter the size or charecter rather than the defined length of 12, a-f, A-F, 0-9.

Code:
_____________________________________
@ECHO off
if not exist %1 then goto bye
SET MYVAL=%1
SET MYVAL=%MYVAL:x=r% 
SET MYVAL=%MYVAL:0=x% 
SET MYVAL=%MYVAL:1=x% 
SET MYVAL=%MYVAL:2=x% 
SET MYVAL=%MYVAL:3=x% 
SET MYVAL=%MYVAL:4=x% 
SET MYVAL=%MYVAL:5=x% 
SET MYVAL=%MYVAL:6=x% 
SET MYVAL=%MYVAL:7=x% 
SET MYVAL=%MYVAL:8=x% 
SET MYVAL=%MYVAL:9=x% 
SET MYVAL=%MYVAL:A=x% 
SET MYVAL=%MYVAL:B=x% 
SET MYVAL=%MYVAL:C=x% 
SET MYVAL=%MYVAL:D=x% 
SET MYVAL=%MYVAL:E=x% 
SET MYVAL=%MYVAL:F=x% 
SET MYVAL=%MYVAL:a=x% 
SET MYVAL=%MYVAL:b=x% 
SET MYVAL=%MYVAL:c=x% 
SET MYVAL=%MYVAL:d=x% 
SET MYVAL=%MYVAL:e=x% 
SET MYVAL=%MYVAL:f=x% 
IF /i &quot;%MYVAL%&quot;!==!&quot;xxxxxxxxxxxx&quot; GOTO bye
REM Change date-time format w/out /, create dir and copy files.
for /F &quot;tokens=1-5 delims=/ &quot; %%i in (&#039;date /t&#039;) do (
set Year=%%l
set Month=%%j
set Day=%%k
set Date=%%l-%%j-%%k
)
for /F &quot;tokens=1-2 delims=: &quot; %%m in (&#039;time /t&#039;) do (
set time=-%%m
set second=-%%n
set time=-%%m-%%n
)
set file=%drive%%Date%%time%
copy c:\macfiltering\calloutfilterfile\maclist.txt c:\macfiltering\backup\%file%.sav
echo %1 &gt;&gt; c:\macfiltering\calloutfilterfile\maclist.txt
cls
echo msgbox &quot;%1 now entered into C:\macfiltering\backup\date-time.sav&quot; &gt; 1.vbs
wscript 1.vbs
start net stop dhcpserver
start net start dhcpserver
:bye


________________________________________________



Any ideas? Any help would be greatly appreciated! 

Thanks,
Stephen</description>
		<content:encoded><![CDATA[<p>Trying to feed it a mac address via %1. Example, if the batch is nameed test.bat I would like to feed it like this:</p>
<p>C:\&gt;test.bat 0020E7666999</p>
<p>Sadly it adds anything I throw at it into the file no matter the size or charecter rather than the defined length of 12, a-f, A-F, 0-9.</p>
<p>Code:<br />
_____________________________________<br />
@ECHO off<br />
if not exist %1 then goto bye<br />
SET MYVAL=%1<br />
SET MYVAL=%MYVAL:x=r%<br />
SET MYVAL=%MYVAL:0=x%<br />
SET MYVAL=%MYVAL:1=x%<br />
SET MYVAL=%MYVAL:2=x%<br />
SET MYVAL=%MYVAL:3=x%<br />
SET MYVAL=%MYVAL:4=x%<br />
SET MYVAL=%MYVAL:5=x%<br />
SET MYVAL=%MYVAL:6=x%<br />
SET MYVAL=%MYVAL:7=x%<br />
SET MYVAL=%MYVAL:8=x%<br />
SET MYVAL=%MYVAL:9=x%<br />
SET MYVAL=%MYVAL:A=x%<br />
SET MYVAL=%MYVAL:B=x%<br />
SET MYVAL=%MYVAL:C=x%<br />
SET MYVAL=%MYVAL:D=x%<br />
SET MYVAL=%MYVAL:E=x%<br />
SET MYVAL=%MYVAL:F=x%<br />
SET MYVAL=%MYVAL:a=x%<br />
SET MYVAL=%MYVAL:b=x%<br />
SET MYVAL=%MYVAL:c=x%<br />
SET MYVAL=%MYVAL:d=x%<br />
SET MYVAL=%MYVAL:e=x%<br />
SET MYVAL=%MYVAL:f=x%<br />
IF /i &#8220;%MYVAL%&#8221;!==!&#8221;xxxxxxxxxxxx&#8221; GOTO bye<br />
REM Change date-time format w/out /, create dir and copy files.<br />
for /F &#8220;tokens=1-5 delims=/ &#8221; %%i in (&#8216;date /t&#8217;) do (<br />
set Year=%%l<br />
set Month=%%j<br />
set Day=%%k<br />
set Date=%%l-%%j-%%k<br />
)<br />
for /F &#8220;tokens=1-2 delims=: &#8221; %%m in (&#8216;time /t&#8217;) do (<br />
set time=-%%m<br />
set second=-%%n<br />
set time=-%%m-%%n<br />
)<br />
set file=%drive%%Date%%time%<br />
copy c:\macfiltering\calloutfilterfile\maclist.txt c:\macfiltering\backup\%file%.sav<br />
echo %1 &gt;&gt; c:\macfiltering\calloutfilterfile\maclist.txt<br />
cls<br />
echo msgbox &#8220;%1 now entered into C:\macfiltering\backup\date-time.sav&#8221; &gt; 1.vbs<br />
wscript 1.vbs<br />
start net stop dhcpserver<br />
start net start dhcpserver<br />
:bye</p>
<p>________________________________________________</p>
<p>Any ideas? Any help would be greatly appreciated! </p>
<p>Thanks,<br />
Stephen</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Burke</title>
		<link>http://www.devpicayune.com/entry/200705151708/comment-page-1#comment-21735</link>
		<dc:creator>Stephen Burke</dc:creator>
		<pubDate>Thu, 26 Jun 2008 23:27:48 +0000</pubDate>
		<guid isPermaLink="false">#comment-21735</guid>
		<description>Here&#039;s the rest:

Code:
______________________________________

REM Change date-time format w/out /, create dir and copy files.

for /F &quot;tokens=1-5 delims=/ &quot; %%i in (&#039;date /t&#039;) do (

set YeaR = %%l

set Month=%%j

set Day=%%k

set Date=%%l-%%j-%%k

)

for /F &quot;tokens=1-2 delims=: &quot; %%m in (&#039;time /t&#039;) do (

set time=-%%m

set second=-%%n

set time=-%%m-%%n

)

set file=%drive%%Date%%time%

copy c:\macfiltering\calloutfilterfile\maclist.txt 

c:\macfiltering\backup\%file%.sav

 

echo %1 &gt;&gt; c:\macfiltering\calloutfilterfile\maclist.txt

 

cls

echo msgbox &quot;%1 now entered into the file. If this is an error, revert to the 

last file in c:\macfiltering\backup\date-time.sav&quot; &gt; 1.vbs

wscript 1.vbs

cls

echo msgbox &quot;Click OK Stop and Start DHCP Server&quot; &gt; 2.vbs

wscript 2.vbs

start net stop dhcpserver

start net start dhcpserver

:BYE</description>
		<content:encoded><![CDATA[<p>Here&#8217;s the rest:</p>
<p>Code:<br />
______________________________________</p>
<p>REM Change date-time format w/out /, create dir and copy files.</p>
<p>for /F &#8220;tokens=1-5 delims=/ &#8221; %%i in (&#8216;date /t&#8217;) do (</p>
<p>set YeaR = %%l</p>
<p>set Month=%%j</p>
<p>set Day=%%k</p>
<p>set Date=%%l-%%j-%%k</p>
<p>)</p>
<p>for /F &#8220;tokens=1-2 delims=: &#8221; %%m in (&#8216;time /t&#8217;) do (</p>
<p>set time=-%%m</p>
<p>set second=-%%n</p>
<p>set time=-%%m-%%n</p>
<p>)</p>
<p>set file=%drive%%Date%%time%</p>
<p>copy c:\macfiltering\calloutfilterfile\maclist.txt </p>
<p>c:\macfiltering\backup\%file%.sav</p>
<p>echo %1 &gt;&gt; c:\macfiltering\calloutfilterfile\maclist.txt</p>
<p>cls</p>
<p>echo msgbox &#8220;%1 now entered into the file. If this is an error, revert to the </p>
<p>last file in c:\macfiltering\backup\date-time.sav&#8221; &gt; 1.vbs</p>
<p>wscript 1.vbs</p>
<p>cls</p>
<p>echo msgbox &#8220;Click OK Stop and Start DHCP Server&#8221; &gt; 2.vbs</p>
<p>wscript 2.vbs</p>
<p>start net stop dhcpserver</p>
<p>start net start dhcpserver</p>
<p>:BYE</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ScW</title>
		<link>http://www.devpicayune.com/entry/200705151708/comment-page-1#comment-44</link>
		<dc:creator>ScW</dc:creator>
		<pubDate>Wed, 21 Nov 2007 16:04:36 +0000</pubDate>
		<guid isPermaLink="false">#comment-44</guid>
		<description>Glad it helped... it really is nice to know that it&#039;s not a waisted effort to post things.</description>
		<content:encoded><![CDATA[<p>Glad it helped&#8230; it really is nice to know that it&#8217;s not a waisted effort to post things.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: edyalc</title>
		<link>http://www.devpicayune.com/entry/200705151708/comment-page-1#comment-43</link>
		<dc:creator>edyalc</dc:creator>
		<pubDate>Wed, 21 Nov 2007 09:32:38 +0000</pubDate>
		<guid isPermaLink="false">#comment-43</guid>
		<description>you have no idea how this info saved me from doing complicated string manipulations in .bat files. =P

thanks for sharing.. =D</description>
		<content:encoded><![CDATA[<p>you have no idea how this info saved me from doing complicated string manipulations in .bat files. =P</p>
<p>thanks for sharing.. =D</p>
]]></content:encoded>
	</item>
</channel>
</rss>
