[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 291
  • Last Modified:

Obtain exclusive (read write) access to network files with VB.NET

Until recently I've used a simple batch file to perform overnight maintenance of our Source Safe database. This batch file is run on the same server that hosts the SourceSafe DB.

The following line checks for files on the server being accessed by users client PCs, then closes the files so that maintenance can begin:

REM *** Close All VSS Files Opened by Network Clients ***
FOR /f "skip=4 tokens=1,2" %%a IN ('net files') DO IF %%b GTR %_ROOT% net files %%a /close

I'm replacing the batch file with a .NET application and therefore need to achieve the same thing through VB.NET.

All help much appreciated!
Alex
0
alexjlewis
Asked:
alexjlewis
  • 2
1 Solution
 
Bob LearnedCommented:
And, what do you want from us?

Bob
0
 
alexjlewisAuthor Commented:
"I'm replacing the batch file with a .NET application and therefore need to achieve the same thing through VB.NET."

Sorry if the above wasn't clear. How else can I put it? What's the VB equivalent to achieve what I'm currently doing with the line in the existing batch file that reads:

FOR /f "skip=4 tokens=1,2" %%a IN ('net files') DO IF %%b GTR %_ROOT% net files %%a /close

Many thanks.
Alex
0
 
Bob LearnedCommented:
There isn't any .NET equivalent for 'NET FILE /close'.  You can still run a batch file within a .NET program, though.

Bob
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now