<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">
<rss version="0.91">
<channel>
	<title>SS64 Discussion Forum - Derniers posts</title>
	<link>http://www.ss64.org/</link>
	<description> SS64 Discussion Forum</description>
	<language>fr-be</language>
	<item>
		<title>Windows scripting -  How to get &quot;for&quot; NOT to skip empty variables in its output</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1158#p1158</link>
		<description><![CDATA[Posted: Yesterday 18:53:53Author: <strong>Simon Sheppard</strong><p>Heres a slightly different approach you might find easier to follow:<br /></p><div class="codebox"><div class="incqbox"><h4>Code:</h4><div class="scrollbox" style="height: 27em"><pre>@echo off
setlocal

  :: put the values into a variable
  set _fixedfields=1,2,,4,5

  :: change any missing value into a space (two commas become comma-space-comma)
  set _fixedfields=%_fixedfields:,,=, ,%

  ::Echo what we have so far
  set _fixedfields

  :: now break it apart using FOR
  for /f &quot;tokens=1-5 delims=,&quot; %%G in (&quot;%_fixedfields%&quot;) do (
    echo [%%~G] [%%~H] [%%~I] [%%~J] [%%~K]
  )</pre></div></div></div><p>Just be aware that the missing value is now a space character, you may need to allow for that depending what else the script is doing.</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  hash source using RoboCopy</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1157#p1157</link>
		<description><![CDATA[Posted: Yesterday 18:21:49Author: <strong>drifty</strong><p>Yes all the switches and extentions are in the rcj file.<br />I made the change and this is what was created in the hashes.txt file:<br /><br />//<br />// File Checksum Integrity Verifier version 2.05.<br />//<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;*.doc\*<br /><br />&nbsp; &nbsp; Error msg&nbsp; : The filename, directory name, or volume label syntax is incorrect.<br /><br />&nbsp; &nbsp; Error code : 7b<br /><br />I think it is looking for just .doc ?<br /><br />If the</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  How to get &quot;for&quot; NOT to skip empty variables in its output</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1156#p1156</link>
		<description><![CDATA[Posted: Yesterday 09:38:49Author: <strong>SickPuppy</strong><p>I guess with my very limited scripting skills I need a little bit more time to exactly understand, how you are doing it, but it works like a charm.<br /><br />Many thanks bluesxman.</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  How to get &quot;for&quot; NOT to skip empty variables in its output</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1155#p1155</link>
		<description><![CDATA[Posted: Yesterday 06:26:30Author: <strong>bluesxman</strong><p>You're going to have to pre-process the lines, such that the empty fields aren't empty any more.<br /><br />Here's an example of how you could approach it:</p><div class="codebox"><div class="incqbox"><h4>Code:</h4><div class="scrollbox" style="height: 30em"><pre>@echo off

setlocal enabledelayedexpansion

set &quot;_delim=,&quot;

REM put each whole line into a single %% token
for /f &quot;tokens=*&quot; %%x in (&quot;1,2,,4,5&quot;) do (
    set &quot;_fixedfields=%%~x&quot;

    REM wrap the delimiter, and indeed the whole string, in &quot; to make all the fields valid double-quoted strings
    set &quot;_fixedfields=&quot;!_fixedfields:%_delim%=&quot;%_delim%&quot;!&quot;&quot;

    REM now just break it apart as before, stripping all the &quot; we just added to recreate any empty fields
    for /f &quot;usebackq tokens=1-5 delims=%_delim%&quot; %%a in ('!_fixedfields!') do echo &quot;%%~a&quot; &quot;%%~b&quot; &quot;%%~c&quot; &quot;%%~d&quot; &quot;%%~e&quot;
)

pause</pre></div></div></div><p>Subject to the data you're going to be pumping in, there are some tweaks you might have to make.</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  How to get &quot;for&quot; NOT to skip empty variables in its output</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1154#p1154</link>
		<description><![CDATA[Posted: 2008-May-13 16:31:17Author: <strong>SickPuppy</strong><p>Hi,<br /><br />is there any way to force the &quot;for&quot; statement not to skip empty variables. This would greatly help parsing log file entries in the correct order:<br /><br />Just a quick example:<br /></p><div class="codebox"><div class="incqbox"><h4>Code:</h4><div class="scrollbox" style="height: 6em"><pre>@echo off
for /f &quot;tokens=1-5 delims=,&quot; %%a in (&quot;1,2,,4,5&quot;) do echo &quot;%%a&quot; &quot;%%b&quot; &quot;%%c&quot; &quot;%%d&quot; &quot;%%e&quot;</pre></div></div></div><p>Output is:<br /></p><div class="codebox"><div class="incqbox"><h4>Code:</h4><div class="scrollbox" style="height: 4.5em"><pre>&quot;1&quot; &quot;2&quot; &quot;4&quot; &quot;5&quot; &quot;&quot;</pre></div></div></div><p>I would like to prefer ;):<br /></p><div class="codebox"><div class="incqbox"><h4>Code:</h4><div class="scrollbox" style="height: 4.5em"><pre>&quot;1&quot; &quot;2&quot; &quot;&quot; &quot;4&quot; &quot;5&quot;</pre></div></div></div><p>Thanks for any suggestions.</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  hash source using RoboCopy</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1153#p1153</link>
		<description><![CDATA[Posted: 2008-May-13 08:40:22Author: <strong>bluesxman</strong><p>Hmmm on closer inspection, the documentation for FCIV isn't very clear!<br /><br />Try just &quot;fciv.exe &quot;%%a&quot; -sha1 &gt;&gt; &quot;F:\AB561\Logs\hashes.txt&quot;<br /><br />(I'm presuming that all the switches I used for robocopy are in your .rcj file?)</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  hash source using RoboCopy</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1152#p1152</link>
		<description><![CDATA[Posted: 2008-May-12 21:35:08Author: <strong>drifty</strong><p>I think this is getting closer. If I just run RoboCopy with the standard Job file and tje /L option and create a log of the files first. Next I usded that file for fciv.exe and created an output log hashes.txt. I appears the application can read the file but I get an error and it is logged in the hashes.txt file.<br /><br />CODE<br /><br />F:\AB561\Scripts\robocopy.exe /Job:&quot;F:\AB561\Scripts\LT Onsite Filtered.rcj&quot; &quot;C:\temp&quot; &quot;F:\AB561\Data\PC\C\temp&quot; /L /Log+:&quot;F:\AB561\Logs\KO_Memorex.txt&quot;<br /><br /><br />for /f &quot;usebackq tokens=* delims= &quot; %%a in (&quot;F:\AB561\Logs\KO_Memorex.txt&quot;) do (<br />&nbsp; &nbsp; fciv.exe -add &quot;%%a&quot; -sha1 &gt;&gt; &quot;F:\AB561\Logs\hashes.txt&quot;<br />)<br /><br />Error in Log file:<br /><br />//<br />// File Checksum Integrity Verifier version 2.05.<br />//<br />&nbsp; &nbsp; &nbsp; &nbsp; MD5&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SHA-1<br />-------------------------------------------------------------------------<br />&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c:\temp\img00037.jpg\*<br /><br />&nbsp; &nbsp; Error msg&nbsp; : The filename, directory name, or volume label syntax is incorrect.<br /><br />&nbsp; &nbsp; Error code : 7b</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  hash source using RoboCopy</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1151#p1151</link>
		<description><![CDATA[Posted: 2008-May-12 16:41:24Author: <strong>bluesxman</strong><p>The simple answer to how the list was being using by fciv is that it wasn't.<br /><br />Having quickly looked at some fciv documentation and reviewing my initial code offering (which was a bit wrong BTW ... oops ... but I did put an &quot;untested&quot; disclaimer on it :D) I've come up with this <span style="color: red"><strong>also untested</strong></span> beauty, based on said initial code offering:</p><div class="codebox"><div class="incqbox"><h4>Code:</h4><div class="scrollbox" style="height: 13.5em"><pre>REM I've picked GIF and JPG files just to illustrate
REM by all means use your robocopy job file to select the files you want
robocopy /njs /njh /ndl /ns /nc /l x:\source c:\dummy *.jpg *.gif /log:&quot;tempfile.txt&quot;

for /f &quot;usebackq tokens=* delims= &quot; %%a in (&quot;tempfile.txt&quot;) do (
    fciv.exe -add &quot;%%a&quot; -sha1 -md5  &gt;&gt; &quot;hashes.txt&quot;
)</pre></div></div></div><p>Note that I've output the robocopy log to a file which we pick up in the &quot;for&quot; command ... and made corrections to the fciv command line I used before.&nbsp; By all means hack this around to fit back in your script.</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  hash source using RoboCopy</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1150#p1150</link>
		<description><![CDATA[Posted: 2008-May-12 14:34:16Author: <strong>drifty</strong><p>Your idea is better than what I was thinking. Robocopy is the primary tool I use for this and I would much rather have it get a list of files. Because I use a job file with various filters it would make more sense to have RoboCopy generate it. <br />What I don't get is how the list using C;\dummy is created and accessed by fciv. I seem to be hung up on having a list of files with extentions or extensions in a log that is used as a filter.<br />-Frank</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  hash source using RoboCopy</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1149#p1149</link>
		<description><![CDATA[Posted: 2008-May-12 10:59:49Author: <strong>bluesxman</strong><p>Sorry I was only quickly scanning your code, didn't look properly at how you were using &quot;%filter%&quot;.<br /><br />But as it stands, your &quot;%Dest_Path%\Scripts\robocopy /njs /njh /ndl /ns /nc /l %Source_Path% c:\dummy&quot; line is serving no purprose whatsoever other than to display a list of files.&nbsp; My initial idea was that you'd use robocopy to create a list of actual filenames to process, then pump that through &quot;fciv&quot; to get your hashes.&nbsp; You would then use the same list to robocopy the files to perform whatever other actions it was you wanted to.<br /><br />Entirely up to you how you want it to work though!</p>]]></description>
	</item>
	<item>
		<title>Linux &amp; OS X bash -  Need Help - Urgent</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1148#p1148</link>
		<description><![CDATA[Posted: 2008-May-12 05:25:18Author: <strong>ashteat</strong><p>I would like to know the command for getting memory usage of target machine.<br />Currently i m using 2 command for getting memory utilization<br /><br />1) top -n 1 | grep Memory<br />output : Memory: 32G real, 3792M free, 41G swap in use, 15G swap free<br /><br />and 2) vmstat<br />output : <br /><br />kthr&nbsp; &nbsp; &nbsp; memory&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; disk&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; faults&nbsp; &nbsp; &nbsp; cpu<br /> r b w&nbsp; &nbsp;swap&nbsp; free&nbsp; re&nbsp; mf pi po fr de sr m0 m1 m2 m3&nbsp; &nbsp;in&nbsp; &nbsp;sy&nbsp; &nbsp;cs us sy id<br /> 0 0 538 9428240 2431272 953 3618 272 33 29 0 14 7 5 5 1 7077 23302 11528 5 4 91<br /><br /><br />so which one is correct command ?<br /><br />I really appreciate ur help on this.</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  hash source using RoboCopy</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1147#p1147</link>
		<description><![CDATA[Posted: 2008-May-12 01:20:01Author: <strong>drifty</strong><p>Yes you are right about<br />Code<br />&quot;%Dest_Path%\Logs\%Log_Name%&quot;<br /><br />What I am not quite sure of is the file defined as &quot;%filter%&quot;.&nbsp; I created a text file with the extensions that I want to include. Similar to the .rcj file with <br />&nbsp; &nbsp; /IF&nbsp; &nbsp; &nbsp; &nbsp; :: Include Files matching these names<br />&nbsp; &nbsp; &nbsp; &nbsp; *.doc<br />&nbsp; &nbsp; &nbsp; &nbsp; *.xls<br />&nbsp; &nbsp; &nbsp; &nbsp; *.txt<br />except it only has:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.doc<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.xls<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.txt<br />Seems like fciv can use this but *.doc doesn't work at all. <br /><br />What I want is to hash the files before and after a copy and if need be use the same filter list for the hash as I use in the job file for RoboCopy. So I set %filter% to the include filter = Include_Filter.txt. So when I run the batch file it reads the filter and only hashes the file extentions in the list. I does include the file when I use this filter and -type but it doesn't exclude files such a .exe when I use the exclude_filter.txt and&nbsp; -exe.<br /><br />So I am clearly not getting something.</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  runonce for default user profile, can it be scripted?</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1146#p1146</link>
		<description><![CDATA[Posted: 2008-May-11 18:42:13Author: <strong>Simon Sheppard</strong><p>If this is on a domain, then you can just customize one 'Default User' and copy it to the Netlogon share of&nbsp; the Domain Controller.<br /><br />see Q168475<br /><a href="http://support.microsoft.com/kb/168475">http://support.microsoft.com/kb/168475</a><br /><br />Alternatively apply a System Policy to change the registry settings.</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  runonce for default user profile, can it be scripted?</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1145#p1145</link>
		<description><![CDATA[Posted: 2008-May-11 13:06:50Author: <strong>bluesxman</strong><p>OK I think I understand what you're up to.&nbsp; I have a couple of thoughts on the matter (bearing in mind I've not tested either) ...<br /><br />You might try using &quot;psgetsid&quot;, available from the website formerly known as <a href="http://www.sysinternals.com">Sysinternals</a> (latterly Borged by Microsoft), to figure out the SID of the new user account.&nbsp; You can then (probably) do what you want to do with by using the REG command to address &quot;HKU\&lt;User SID&gt;\Software\Microsoft\Windows\CurrentVersion\RunOnce&quot;.<br /><br />Or, more straightforwardly, why not just drop the &quot;RunOnce&quot; thing into the Default User registry by addressing &quot;HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\RunOnce&quot;, again with the REG command?</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  runonce for default user profile, can it be scripted?</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1144#p1144</link>
		<description><![CDATA[Posted: 2008-May-11 02:13:29Author: <strong>NDog</strong><p>Hi. I am trying to create a value in the default user profile runonce to point at a login script.<br /><br />This means that when you create a new user profile in xp, the runonce script will execute when the user first logs in.<br /><br />As far as I am aware, this process can not be done by script, but only manually, like this.<br /><br />01) open regedit<br />02) go to HKEY_USERS<br />03) Load Hive<br />04) Browse to C:\Documents and Settings\Default User\ntuser.dat<br />05) give it a temporary key name, for example ZZZ<br />06) go to HKEY_USERS\ZZZ\Software\Microsoft\Windows\CurrentVersion<br />07) Create a key RunOnce<br />08) Create a string value there eg: First Run, then change the value to where your script sits, eg: &quot;D:\User\zxp\newUserProfile.cmd&quot;<br />09) go back to HKEY_USERS\ZZZ<br />10) unload the hive<br /><br />Now when you create a new user, the runonce value runs on the first login so you can run a first time user script; eg newUserProfile.cmd<br /><br />The script below is only for illustrative purposes. but if anyone knows how i can add in a registry value into the different user hive by script, rather than manually, that will be cool, and a great time saver :pc: <br /><br />Thanks :D<br /><br />newUserProfile.cmd<br /></p><div class="codebox"><div class="incqbox"><h4>Code:</h4><div class="scrollbox" style="height: 35em"><pre>@echo off&amp;cls
title=%~n0

:: Stored @
:: D:\User\zXP\newUserProfile.cmd
::

taskkill /f /im explorer.exe

::
:: Create User Folder on data partition
::

echo Setting up your user profile for first time use ...

:: Set location where the users files will save to (NOT on systemdrive)
set _userstore=D:\User

set _desktop=%_userstore%\%USERNAME%\Desktop
set _favorites=%_userstore%\%USERNAME%\Favorites
set _mydocuments=%_userstore%\%USERNAME%\My Documents
set _mymusic=%_userstore%\%USERNAME%\My Documents\My Music
set _mypictures=%_userstore%\%USERNAME%\My Documents\My Pictures
set _myvideo=%_userstore%\%USERNAME%\My Documents\My Video
md &quot;%_desktop%&quot;
md &quot;%_favorites%&quot;
md &quot;%_mydocuments%&quot;
md &quot;%_mymusic%&quot;
md &quot;%_mypictures%&quot;
md &quot;%_myvideo%&quot;

:: Update registry to point @ the user folders
set _regusf=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
reg add &quot;%_regusf%&quot; /v Desktop /t REG_EXPAND_SZ /d &quot;%_desktop%&quot; /f
reg add &quot;%_regusf%&quot; /v Favorites /t REG_EXPAND_SZ /d &quot;%_favorites%&quot; /f
reg add &quot;%_regusf%&quot; /v Personal /t REG_EXPAND_SZ /d &quot;%_mydocuments%&quot; /f
reg add &quot;%_regusf%&quot; /v My Music /t REG_EXPAND_SZ /d &quot;%_mymusic%&quot; /f
reg add &quot;%_regusf%&quot; /v My Pictures /t REG_EXPAND_SZ /d &quot;%_mypictures%&quot; /f
reg add &quot;%_regusf%&quot; /v My Video /t REG_EXPAND_SZ /d &quot;%_myvideo%&quot; /f

:: Restart explorer.exe so changes are immediate

start explorer.exe

:: Remove unneccesary user profile folders on systemdrive
rd /s /q &quot;%USERPROFILE%\Favorites&quot;
rd /s /q &quot;%USERPROFILE%\My Documents&quot;
rd /s /q &quot;%USERPROFILE%\My Music&quot;
rd /s /q &quot;%USERPROFILE%\My Pictures&quot;
rd /s /q &quot;%USERPROFILE%\My Video&quot;

::
:: UI Tweaks
::

::
:: Files Cleanup
::

del /q &quot;%windir%\*.log&quot;
del /q &quot;%windir%\*.tmp&quot;
del /q &quot;%windir%\Temp\*.*&quot;

::
:: Services
::

net stop &quot;wuauserv&quot;

sc config &quot;Alerter&quot; start= disabled
sc config &quot;browser&quot; start= disabled
sc config &quot;messenger&quot; start= disabled
sc config &quot;upnphost&quot; start= disabled
sc config &quot;wuauserv&quot; start= disabled

::
:: Restrictions
::</pre></div></div></div>]]></description>
	</item>
	<item>
		<title>Windows scripting -  Make a script independent of the &quot;System drive letter&quot;</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1143#p1143</link>
		<description><![CDATA[Posted: 2008-May-11 00:57:01Author: <strong>NDog</strong><p>In this case I would use the %ProgramFiles% to find the winrar folder.<br /><br />HOMEDRIVE=C:<br />ProgramFiles=C:\Program Files<br />SystemDrive=C:<br />SystemRoot=C:\WINDOWS<br /><br />If you have windows installed on another drive, that is bad design, you should always install windows onto an active partition, if you are multi-booting of a hard-drive you should set the partition active before installing the OS, and using a boot loader to activate it.<br /><br />But those variables will change if you installed windows on d: then they will change, so its a good idea to use something like %ProgramFiles% rather than C:\Program Files. I always use that in scripts for example<br /><br /></p><div class="codebox"><div class="incqbox"><h4>Code:</h4><div class="scrollbox" style="height: 21em"><pre>@ECHO OFF
TITLE Cleanup, Defrag, Shutdown - SAFE TO EXIT ANYTIME

set app1=%programfiles%\CCleaner\CCleaner.exe
set app2=%programfiles%\JKDefrag\JkDefragCmd
set app3=%programfiles%\NT Registry Optimizer\NTREGOPT.EXE

    &quot;%app1%&quot; /AUTO
    &quot;%app2%&quot;
    &quot;%app3%&quot; silent

    SHUTDOWN -s -t 60</pre></div></div></div>]]></description>
	</item>
	<item>
		<title>Windows scripting -  Make a script independent of the &quot;System drive letter&quot;</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1142#p1142</link>
		<description><![CDATA[Posted: 2008-May-11 00:05:01Author: <strong>budhax</strong><p>Hello,<br />In some case, the &quot;System drive letter&quot; is different of C:, and a script can use an absolute path like C:\folder\bla.<br />So, this script cannot works if MS Windows is installed in a difference drive letter of C:<br /><br />Here is a script using an absolute path in the C: drive (where C: is the System drive letter).<br /><br /></p><div class="codebox"><div class="incqbox"><h4>Code:</h4><div class="scrollbox" style="height: 12em"><pre>@ECHO OFF
SETLOCAL
IF NOT EXIST &quot;C:\PROGRAM Files\WinRAR&quot; (ECHO *** WinRAR is missing&amp;Pause&amp;EXIT)
SET PATH=&quot;C:\PROGRAM Files\WinRAR\&quot;;%PATH%
:: Then do something using WinRAR
ENDLOCAL</pre></div></div></div><p><strong><br />Is this method enough and safe to make the script independent of the &quot;System drive letter&quot;?</strong><br />METHOD:<br />- add a variable: SET SD=%SYSTEMDRIVE%<br />- replace all absolute drive&nbsp; C:&nbsp; by&nbsp; %SD%<br /><br />Any comment?<br />Thanks and regards.<br /><br /></p><div class="codebox"><div class="incqbox"><h4>Code:</h4><div class="scrollbox" style="height: 13.5em"><pre>@ECHO OFF
SETLOCAL
SET SD=%SYSTEMDRIVE%
IF NOT EXIST &quot;%SD%\PROGRAM Files\WinRAR&quot; (ECHO *** WinRAR is missing&amp;Pause&amp;EXIT)
SET PATH=&quot;%SD%\PROGRAM Files\WinRAR\&quot;;%PATH%
:: Then do something using WinRAR
ENDLOCAL</pre></div></div></div>]]></description>
	</item>
	<item>
		<title>Windows scripting -  turning back the clock</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1141#p1141</link>
		<description><![CDATA[Posted: 2008-May-10 14:56:02Author: <strong>bluesxman</strong><p>Knocked this up for something at work.&nbsp; It will subtract the given number of minutes from the current time (from 1 to 1440 inclusive -- IE 1 full day).&nbsp; With a bit of tweaking it could be made to handle greater values (but that was without the scope of what I needed it for, so I didn't bother with that yet).&nbsp; For the same reason, it doesn't bother to handle leap year scenarios more complicated than anything that's going to happen between now and 2099.&nbsp; It also assumes 24 hour clock and dd/mm/yyyy dates.</p><div class="codebox"><div class="incqbox"><h4>Code:</h4><div class="scrollbox" style="height: 35em"><pre>@echo off

setlocal enabledelayedexpansion

set step=%~1
set /a step+=0

REM if an out of bounds value is given, we do nothing
if %step% GTR 1440 set step=0
if %step% LSS 0    set step=0

set /a &quot;step.hh=step /  60&quot;
set /a &quot;step.mm=step %% 60&quot;

set time=%time: =0%
set date=%date%

REM getting rid of the pesky zero padding that'll screw up calculations later
set /a in.year=  ( %date:~-4% )
set /a in.month= ( %date:~-7,1%  * 10 ) + ( %date:~-6,1% )
set /a in.day=   ( %date:~-10,1% * 10 ) + ( %date:~-9,1% )

set /a in.hh=    ( %time:~0,1% * 10 ) + ( %time:~1,1% )
set /a in.mm=    ( %time:~3,1% * 10 ) + ( %time:~4,1% )

REM duplicate the &quot;in.&quot; values as &quot;out.&quot; values, and only play with them from now on
for /f &quot;usebackq tokens=2,3 delims=.=&quot; %%a in (`set in.`) do set out.%%a=%%b

set /a &quot;leap.check=in.year %% 4&quot;

if %leap.check% EQU 0 (set 28.or.29=29) ELSE (set 28.or.29=28)

set month.1=31
set month.2=!28.or.29!
set month.3=31
set month.4=30
set month.5=31
set month.6=30
set month.7=31
set month.8=31
set month.9=30
set month.10=31
set month.11=30
set month.12=31

set /a out.mm-=step.mm
set /a out.hh-=step.hh

if %out.mm% LSS 0 (
    set /a out.mm+=60
    set /a out.hh-=1
)

if %out.hh% LSS 0 (
    set /a out.hh+=24
    set /a out.day-=1
)

if %out.day% EQU 0 (
    set /a out.month-=1
    if !out.month! EQU 0 (
        set /a out.month=12
        set /a out.year-=1
    )
    call :set_day
)

REM zero pad everything that needs it

for %%p in (month day hh mm) do (
    for %%d in (in out) do (
        set %%d.%%p=0!%%d.%%p!
        set %%d.%%p=!%%d.%%p:~-2!
    )
)

echo:IN : %in.year%/%in.month%/%in.day% %in.hh%:%in.mm%
echo:OUT: %out.year%/%out.month%/%out.day% %out.hh%:%out.mm%

goto :EOF

:set_day

set out.day=!month.%out.month%!

goto :EOF</pre></div></div></div><p>I'm sure this problem has been solved many times before by many people.&nbsp; But I like to do things for myself.</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  hash source using RoboCopy</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1140#p1140</link>
		<description><![CDATA[Posted: 2008-May-10 12:33:50Author: <strong>bluesxman</strong><p>Glad to be of help.<br /><br />Couple of things ...<br /><br />You don't seem to have saved your robocopy output to the file defined as &quot;%filter%&quot;, thus the subsequent &quot;for&quot; loop won't work as it's meant to.<br /><br />Also I presume you meant to do this:</p><div class="codebox"><div class="incqbox"><h4>Code:</h4><div class="scrollbox" style="height: 4.5em"><pre>echo        &quot;%Dest_Path%\Logs\%Log_Name%&quot;</pre></div></div></div><p>Rather than this:</p><div class="codebox"><div class="incqbox"><h4>Code:</h4><div class="scrollbox" style="height: 4.5em"><pre>echo        %Dest_Path%\Logs\Source_Log.txt&quot;</pre></div></div></div><p>Oh, and you might want to investigate using &quot;set /p&quot; instead of</p><div class="codebox"><div class="incqbox"><h4>Code:</h4><div class="scrollbox" style="height: 6em"><pre>echo If this is correct:
pause</pre></div></div></div><p>... so that you can make exiting the script at this point a bit cleaner than a Ctrl+C.&nbsp; Entirely up to you though.</p>]]></description>
	</item>
	<item>
		<title>Windows scripting -  hash source using RoboCopy</title>
		<link>http://www.ss64.org/viewtopic.php?pid=1139#p1139</link>
		<description><![CDATA[Posted: 2008-May-09 21:09:39Author: <strong>drifty</strong><p>First - thanks very much for all the help. I would not have been able to figure this out on my own.<br />Here is the batch file that does what I need:<br /><br />CODE<br />cls<br />@echo off<br /><br />:: ##### Set these variables before running the batch file ###############<br /><br />set Project_Alias=AB561<br />set Asset_Tag=KO_334455<br />set Filter=IncludeFilter.txt<br />set Source_Path=\\server\LT\share\Test<br />set Dest_Path=F:\AB561<br />set Log_Name=Source_Log.txt<br /><br />:: The log file is created first and the source information is entered. <br />:: After the SHA1 hash values are calculated they are appended to the log. <br />:: IncludeFilter.txt contains the file extentions that will be used as a filter for the source.<br /><br />(<br />&nbsp; &nbsp; echo: <br />&nbsp; &nbsp; echo: ===============================&nbsp; <br />&nbsp; &nbsp; echo: Source Hash - New Log Entry<br />&nbsp; &nbsp; echo: ===============================<br />&nbsp; &nbsp; echo. <br />&nbsp; &nbsp; echo: Source - Collection Specifics:<br />&nbsp; &nbsp; echo: Project Alias ..........%Project_Alias%<br />&nbsp; &nbsp; echo: Asset Tag ..............%Asset_Tag%<br />&nbsp; &nbsp; echo: Filter .................%Filter%<br />&nbsp; &nbsp; echo: Source_Path ............%Source_Path%<br />&nbsp; &nbsp; echo: System Date.............%date%&nbsp; %time%<br />&nbsp; &nbsp; echo: Computer Name...........%computername% <br />&nbsp; &nbsp; echo: User Logged On..........%USERNAME%<br />&nbsp; &nbsp; echo: User Domain ............%USERDOMAIN%<br />&nbsp; &nbsp; echo: <br />&nbsp; &nbsp; echo.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SHA1 Hash Values&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Source Path/File Name<br />&nbsp; &nbsp; echo: ======================================= ===========================<br />&nbsp; &nbsp; <br />) &gt;&gt; %Dest_Path%\Logs\%Log_Name%<br /><br />:: Example robocopy /njs /njh /ndl /ns /nc /l C:\temp c:\dummy<br />:: C:temp is the source and c:\dummy is a dummy destination call so RoboCopy will not error out<br /><br />echo Hash using the following values:<br />&nbsp; &nbsp; &nbsp; echo: Project Alias ..........%Project_Alias%<br />&nbsp; &nbsp; &nbsp; echo: Asset Tag ..............%Asset_Tag%<br />&nbsp; &nbsp; &nbsp; echo: Filter .................%Filter%<br />&nbsp; &nbsp; &nbsp; echo: Source Path ............%Source_Path%<br />&nbsp; &nbsp; &nbsp; echo: Destination Path........%Dest_Path%\Logs\%Log_Name%<br /><br />echo If this is correct:<br />Pause<br /><br />%Dest_Path%\Scripts\robocopy /njs /njh /ndl /ns /nc /l %Source_Path% c:\dummy <br /><br />echo&nbsp; Calculating hash values for %Source_Path%<br /><br />for /f &quot;usebackq tokens=* delims= &quot; %%a in (%Filter%) do (<br />&nbsp; &nbsp; fciv.exe&nbsp; -add &quot;%Source_Path%&quot; -type &quot;%%a&quot; -r -sha1 | find &quot;\&quot;&nbsp; &gt;&gt; %Dest_Path%\Logs\%Log_Name%<br />)<br /><br />cls<br /><br />COLOR B<br /><br />echo. <br />echo. <br />echo&nbsp; &nbsp; &nbsp; &nbsp;-----The Calculation IS COMPLETE--------&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />echo&nbsp; &nbsp; &nbsp; &nbsp;REVIEW THE Source LOG FOR DETAILS&nbsp; <br />echo&nbsp; &nbsp; &nbsp; &nbsp; %Dest_Path%\Logs\Source_Log.txt&quot;<br />echo. <br />echo. <br /> <br />Pause</p>]]></description>
	</item>
</channel>
</rss>
