<?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: How to close open files on a server share</title>
	<atom:link href="http://caseelse.net/2008/05/17/how-to-close-open-files-on-a-server-share/feed/" rel="self" type="application/rss+xml" />
	<link>http://caseelse.net/2008/05/17/how-to-close-open-files-on-a-server-share/</link>
	<description>/*** Code's last stand ***/</description>
	<lastBuildDate>Tue, 22 Jun 2010 16:39:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Ashley</title>
		<link>http://caseelse.net/2008/05/17/how-to-close-open-files-on-a-server-share/comment-page-1/#comment-343</link>
		<dc:creator>Ashley</dc:creator>
		<pubDate>Thu, 11 Feb 2010 00:59:44 +0000</pubDate>
		<guid isPermaLink="false">http://neilbryant.net/articles/?p=3#comment-343</guid>
		<description>How about using OPENFILES instead of Net Files?  The OPENFILES /Query /V command gives the full path to the files.  I cannot seem to fit this in your script.  Can you help please ?</description>
		<content:encoded><![CDATA[<p>How about using OPENFILES instead of Net Files?  The OPENFILES /Query /V command gives the full path to the files.  I cannot seem to fit this in your script.  Can you help please ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil</title>
		<link>http://caseelse.net/2008/05/17/how-to-close-open-files-on-a-server-share/comment-page-1/#comment-342</link>
		<dc:creator>Neil</dc:creator>
		<pubDate>Wed, 10 Feb 2010 14:07:30 +0000</pubDate>
		<guid isPermaLink="false">http://neilbryant.net/articles/?p=3#comment-342</guid>
		<description>Scratch the last line... it was late.

You&#039;ll need the SHARE variable to match the output of NET FILES if you need to restrict the files you close to a certain path (ie, not close all open files.)

If NET FILES is truncating your paths, you will need to use shorter ones, or the Script just isn&#039;t up to what you need it for. You would proably be better off looking into a WMI or PowerShell solution.</description>
		<content:encoded><![CDATA[<p>Scratch the last line&#8230; it was late.</p>
<p>You&#8217;ll need the SHARE variable to match the output of NET FILES if you need to restrict the files you close to a certain path (ie, not close all open files.)</p>
<p>If NET FILES is truncating your paths, you will need to use shorter ones, or the Script just isn&#8217;t up to what you need it for. You would proably be better off looking into a WMI or PowerShell solution.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashley</title>
		<link>http://caseelse.net/2008/05/17/how-to-close-open-files-on-a-server-share/comment-page-1/#comment-341</link>
		<dc:creator>Ashley</dc:creator>
		<pubDate>Wed, 10 Feb 2010 05:58:51 +0000</pubDate>
		<guid isPermaLink="false">http://neilbryant.net/articles/?p=3#comment-341</guid>
		<description>When setting SHARE can I use UNC path?  

How will this fix the issue because the NET FILES command is returning the compressed path?</description>
		<content:encoded><![CDATA[<p>When setting SHARE can I use UNC path?  </p>
<p>How will this fix the issue because the NET FILES command is returning the compressed path?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil</title>
		<link>http://caseelse.net/2008/05/17/how-to-close-open-files-on-a-server-share/comment-page-1/#comment-340</link>
		<dc:creator>Neil</dc:creator>
		<pubDate>Wed, 10 Feb 2010 05:51:33 +0000</pubDate>
		<guid isPermaLink="false">http://neilbryant.net/articles/?p=3#comment-340</guid>
		<description>Ashley, I see what you mean about the compressed path. I expect you&#039;re hitting a limit of the net command.

My advice would be to try setting a shorter share (eg, \Database). Even if all you use it for is this script, it should work.</description>
		<content:encoded><![CDATA[<p>Ashley, I see what you mean about the compressed path. I expect you&#8217;re hitting a limit of the net command.</p>
<p>My advice would be to try setting a shorter share (eg, \Database). Even if all you use it for is this script, it should work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashley</title>
		<link>http://caseelse.net/2008/05/17/how-to-close-open-files-on-a-server-share/comment-page-1/#comment-339</link>
		<dc:creator>Ashley</dc:creator>
		<pubDate>Wed, 10 Feb 2010 04:59:38 +0000</pubDate>
		<guid isPermaLink="false">http://neilbryant.net/articles/?p=3#comment-339</guid>
		<description>Here is the extract of the logs after running the file:

C:\Documents and Settings\adm2sultana&gt;(set share=F:\Infrastructure\Snowinst2\AppData\Nielsen\DATABASE\ )  - is 53 including the /

C:\Documents and Settings\adm2sultana&gt;REM !! IMPORTANT set length in 4th from last line !!  

C:\Documents and Settings\adm2sultana&gt;FOR /F &quot;Skip=4 tokens=1,2&quot; %i in (&#039;NET FILES&#039;) do (IF /I NOT &quot;%i&quot; == &quot;The&quot; (call :checkpath %i &quot;%j&quot;  ) ) 

C:\Documents and Settings\adm2sultana&gt;(IF /I NOT &quot;14232357&quot; == &quot;The&quot; (call :checkpath 14232357 &quot;F:\Infrastructure...V_CONFECTIONERY.IDX&quot;  ) )  - This one is a problem as it is not displaying the whole path and hence when trying to trim this to 53 charecters....it returns the same.

C:\Documents and Settings\adm2sultana&gt;set id=14232357  

C:\Documents and Settings\adm2sultana&gt;set folder=F:\Infrastructure...V_CONFECTIONERY.IDX\  

C:\Documents and Settings\adm2sultana&gt;SET root=F:\Infrastructure...V_CONFECTIONERY.IDX\   

C:\Documents and Settings\adm2sultana&gt;IF /I NOT &quot;F:\Infrastructure...V_CONFECTIONERY.IDX\  &quot; == &quot;F:\Infrastructure\Snowinst2\AppData\Nielsen\DATABASE\&quot; GOTO :EOF  

C:\Documents and Settings\adm2sultana&gt;(IF /I NOT &quot;14232359&quot; == &quot;The&quot; (call :checkpath 14232359 &quot;F:\Infrastructure...V_CONFECTIONERY.TAD&quot;  ) ) 

C:\Documents and Settings\adm2sultana&gt;set id=14232359  

C:\Documents and Settings\adm2sultana&gt;set folder=F:\Infrastructure...V_CONFECTIONERY.TAD\  

C:\Documents and Settings\adm2sultana&gt;SET root=F:\Infrastructure...V_CONFECTIONERY.TAD\   

C:\Documents and Settings\adm2sultana&gt;IF /I NOT &quot;F:\Infrastructure...V_CONFECTIONERY.TAD\  &quot; == &quot;F:\Infrastructure\Snowinst2\AppData\Nielsen\DATABASE\&quot; GOTO :EOF  

C:\Documents and Settings\adm2sultana&gt;(IF /I NOT &quot;14232360&quot; == &quot;The&quot; (call :checkpath 14232360 &quot;F:\Infrastructure...V_CONFECTIONERY.CHR&quot;  ) ) 

C:\Documents and Settings\adm2sultana&gt;set id=14232360  

C:\Documents and Settings\adm2sultana&gt;set folder=F:\Infrastructure...V_CONFECTIONERY.CHR\  

C:\Documents and Settings\adm2sultana&gt;SET root=F:\Infrastructure...V_CONFECTIONERY.CHR\   

C:\Documents and Settings\adm2sultana&gt;IF /I NOT &quot;F:\Infrastructure...V_CONFECTIONERY.CHR\  &quot; == &quot;F:\Infrastructure\Snowinst2\AppData\Nielsen\DATABASE\&quot; GOTO :EOF  

C:\Documents and Settings\adm2sultana&gt;(IF /I NOT &quot;The&quot; == &quot;The&quot; (call :checkpath The &quot;command&quot;  ) ) 

C:\Documents and Settings\adm2sultana&gt;GOTO :EOF</description>
		<content:encoded><![CDATA[<p>Here is the extract of the logs after running the file:</p>
<p>C:\Documents and Settings\adm2sultana&gt;(set share=F:\Infrastructure\Snowinst2\AppData\Nielsen\DATABASE\ )  &#8211; is 53 including the /</p>
<p>C:\Documents and Settings\adm2sultana&gt;REM !! IMPORTANT set length in 4th from last line !!  </p>
<p>C:\Documents and Settings\adm2sultana&gt;FOR /F &#8220;Skip=4 tokens=1,2&#8243; %i in (&#8216;NET FILES&#8217;) do (IF /I NOT &#8220;%i&#8221; == &#8220;The&#8221; (call :checkpath %i &#8220;%j&#8221;  ) ) </p>
<p>C:\Documents and Settings\adm2sultana&gt;(IF /I NOT &#8220;14232357&#8243; == &#8220;The&#8221; (call :checkpath 14232357 &#8220;F:\Infrastructure&#8230;V_CONFECTIONERY.IDX&#8221;  ) )  &#8211; This one is a problem as it is not displaying the whole path and hence when trying to trim this to 53 charecters&#8230;.it returns the same.</p>
<p>C:\Documents and Settings\adm2sultana&gt;set id=14232357  </p>
<p>C:\Documents and Settings\adm2sultana&gt;set folder=F:\Infrastructure&#8230;V_CONFECTIONERY.IDX\  </p>
<p>C:\Documents and Settings\adm2sultana&gt;SET root=F:\Infrastructure&#8230;V_CONFECTIONERY.IDX\   </p>
<p>C:\Documents and Settings\adm2sultana&gt;IF /I NOT &#8220;F:\Infrastructure&#8230;V_CONFECTIONERY.IDX\  &#8221; == &#8220;F:\Infrastructure\Snowinst2\AppData\Nielsen\DATABASE\&#8221; GOTO :EOF  </p>
<p>C:\Documents and Settings\adm2sultana&gt;(IF /I NOT &#8220;14232359&#8243; == &#8220;The&#8221; (call :checkpath 14232359 &#8220;F:\Infrastructure&#8230;V_CONFECTIONERY.TAD&#8221;  ) ) </p>
<p>C:\Documents and Settings\adm2sultana&gt;set id=14232359  </p>
<p>C:\Documents and Settings\adm2sultana&gt;set folder=F:\Infrastructure&#8230;V_CONFECTIONERY.TAD\  </p>
<p>C:\Documents and Settings\adm2sultana&gt;SET root=F:\Infrastructure&#8230;V_CONFECTIONERY.TAD\   </p>
<p>C:\Documents and Settings\adm2sultana&gt;IF /I NOT &#8220;F:\Infrastructure&#8230;V_CONFECTIONERY.TAD\  &#8221; == &#8220;F:\Infrastructure\Snowinst2\AppData\Nielsen\DATABASE\&#8221; GOTO :EOF  </p>
<p>C:\Documents and Settings\adm2sultana&gt;(IF /I NOT &#8220;14232360&#8243; == &#8220;The&#8221; (call :checkpath 14232360 &#8220;F:\Infrastructure&#8230;V_CONFECTIONERY.CHR&#8221;  ) ) </p>
<p>C:\Documents and Settings\adm2sultana&gt;set id=14232360  </p>
<p>C:\Documents and Settings\adm2sultana&gt;set folder=F:\Infrastructure&#8230;V_CONFECTIONERY.CHR\  </p>
<p>C:\Documents and Settings\adm2sultana&gt;SET root=F:\Infrastructure&#8230;V_CONFECTIONERY.CHR\   </p>
<p>C:\Documents and Settings\adm2sultana&gt;IF /I NOT &#8220;F:\Infrastructure&#8230;V_CONFECTIONERY.CHR\  &#8221; == &#8220;F:\Infrastructure\Snowinst2\AppData\Nielsen\DATABASE\&#8221; GOTO :EOF  </p>
<p>C:\Documents and Settings\adm2sultana&gt;(IF /I NOT &#8220;The&#8221; == &#8220;The&#8221; (call :checkpath The &#8220;command&#8221;  ) ) </p>
<p>C:\Documents and Settings\adm2sultana&gt;GOTO :EOF</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil</title>
		<link>http://caseelse.net/2008/05/17/how-to-close-open-files-on-a-server-share/comment-page-1/#comment-338</link>
		<dc:creator>Neil</dc:creator>
		<pubDate>Wed, 10 Feb 2010 04:52:13 +0000</pubDate>
		<guid isPermaLink="false">http://neilbryant.net/articles/?p=3#comment-338</guid>
		<description>Ashley, I&#039;m not certain I understand the question; but try replacing the last three lines with these:

&lt;code&gt;Echo.
Echo %ROOT%*
Echo %SHARE%*&lt;/code&gt;

Then run it, and make sure the two strings are the same length. If not, adjust your &#039;53&#039; until they are. Chances are, you&#039;re not accounting for the &#039;\&#039;, and it needs to be 54 characters, or something similar.</description>
		<content:encoded><![CDATA[<p>Ashley, I&#8217;m not certain I understand the question; but try replacing the last three lines with these:</p>
<p><code>Echo.<br />
Echo %ROOT%*<br />
Echo %SHARE%*</code></p>
<p>Then run it, and make sure the two strings are the same length. If not, adjust your &#8217;53&#8242; until they are. Chances are, you&#8217;re not accounting for the &#8216;\&#8217;, and it needs to be 54 characters, or something similar.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashley</title>
		<link>http://caseelse.net/2008/05/17/how-to-close-open-files-on-a-server-share/comment-page-1/#comment-337</link>
		<dc:creator>Ashley</dc:creator>
		<pubDate>Wed, 10 Feb 2010 03:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://neilbryant.net/articles/?p=3#comment-337</guid>
		<description>how to deal with long Paths to the Share?
net files displays  c:\share\…\file

Set folder=%~2\ 

sets it to the filename within the folder i have set as SHARE eg:  C:\Share\Database So if a file by CAT.HDX is open within this folder the Folder variable gets set to that.

when I am setting root=%FOLDER:~0,53% i get the path with the filename set as root because the lenth of th epath is being displayed as indicated by Christian earlier.....

it never goes to closing the file as the IF command after that is never equal....

Can you please help....The length of my SHARE path is 53 characters.....

Thanks</description>
		<content:encoded><![CDATA[<p>how to deal with long Paths to the Share?<br />
net files displays  c:\share\…\file</p>
<p>Set folder=%~2\ </p>
<p>sets it to the filename within the folder i have set as SHARE eg:  C:\Share\Database So if a file by CAT.HDX is open within this folder the Folder variable gets set to that.</p>
<p>when I am setting root=%FOLDER:~0,53% i get the path with the filename set as root because the lenth of th epath is being displayed as indicated by Christian earlier&#8230;..</p>
<p>it never goes to closing the file as the IF command after that is never equal&#8230;.</p>
<p>Can you please help&#8230;.The length of my SHARE path is 53 characters&#8230;..</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anthony</title>
		<link>http://caseelse.net/2008/05/17/how-to-close-open-files-on-a-server-share/comment-page-1/#comment-294</link>
		<dc:creator>Anthony</dc:creator>
		<pubDate>Wed, 25 Feb 2009 07:24:07 +0000</pubDate>
		<guid isPermaLink="false">http://neilbryant.net/articles/?p=3#comment-294</guid>
		<description>I have a need to not close open shares, but, one share-a particular file that needs to be closed so someone else can reopen it. It gets locked up often enough that it has become a nuisance!

The problem is that although the file path is always the same, all the tools need the ID of the process, which changes every time it is opened on the server where i need to run it...to then use the net file command to close it.   

I would love to run it every 1 minute as well.  I appreciate your code. I was searching for weeks to find someone who had a similar need - and solved it.  It seems that it is you!

Thanks!</description>
		<content:encoded><![CDATA[<p>I have a need to not close open shares, but, one share-a particular file that needs to be closed so someone else can reopen it. It gets locked up often enough that it has become a nuisance!</p>
<p>The problem is that although the file path is always the same, all the tools need the ID of the process, which changes every time it is opened on the server where i need to run it&#8230;to then use the net file command to close it.   </p>
<p>I would love to run it every 1 minute as well.  I appreciate your code. I was searching for weeks to find someone who had a similar need &#8211; and solved it.  It seems that it is you!</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil</title>
		<link>http://caseelse.net/2008/05/17/how-to-close-open-files-on-a-server-share/comment-page-1/#comment-162</link>
		<dc:creator>Neil</dc:creator>
		<pubDate>Thu, 13 Nov 2008 16:12:54 +0000</pubDate>
		<guid isPermaLink="false">http://neilbryant.net/articles/?p=3#comment-162</guid>
		<description>&lt;p&gt;Christian,&lt;/p&gt;
&lt;p&gt;Just make sure you match the SHARE variable to whatever the path to the share is, ie:&lt;/p&gt;
&lt;p&gt;(SET SHARE=c:\share\...\)&lt;/p&gt;
&lt;p&gt;and make sure you set the length near the end:&lt;/p&gt;
&lt;p&gt;SET root=%FOLDER:~0,9%&lt;/p&gt;
&lt;p&gt;&#039;9&#039; should be whatever the length of SHARE is. That line chops off the beginning of the files returned from NET FILES, and compares it to the SHARE you set. If it matches, it&#039;s dropped, and if it doesn&#039;t match it&#039;s ignored.&lt;/p&gt;
&lt;p&gt;The upshot is that anything below the path you set in SHARE will be closed. (Technically, any file whose path begins with that string.)&lt;/p&gt;
&lt;p&gt;HTH&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Christian,</p>
<p>Just make sure you match the SHARE variable to whatever the path to the share is, ie:</p>
<p>(SET SHARE=c:\share\&#8230;\)</p>
<p>and make sure you set the length near the end:</p>
<p>SET root=%FOLDER:~0,9%</p>
<p>&#8217;9&#8242; should be whatever the length of SHARE is. That line chops off the beginning of the files returned from NET FILES, and compares it to the SHARE you set. If it matches, it&#8217;s dropped, and if it doesn&#8217;t match it&#8217;s ignored.</p>
<p>The upshot is that anything below the path you set in SHARE will be closed. (Technically, any file whose path begins with that string.)</p>
<p>HTH</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://caseelse.net/2008/05/17/how-to-close-open-files-on-a-server-share/comment-page-1/#comment-129</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Mon, 20 Oct 2008 06:55:07 +0000</pubDate>
		<guid isPermaLink="false">http://neilbryant.net/articles/?p=3#comment-129</guid>
		<description>how to deal with long Paths to the Share?
net files displays  c:\share\...\file</description>
		<content:encoded><![CDATA[<p>how to deal with long Paths to the Share?<br />
net files displays  c:\share\&#8230;\file</p>
]]></content:encoded>
	</item>
</channel>
</rss>
