Computing.Net > Forums > Disk Operating System > Handle sharing violation in batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Handle sharing violation in batch file

Reply to Message Icon

Name: Tim Evans
Date: July 11, 2002 at 11:25:38 Pacific
Comment:

We use Eudora 5 on a network (Win98 workstations on a Linux/Samba fileserver), and each mailbox generates a locking file when in use (owner.lok). If Windows falls over, the lok file is left & generates a false 'mailbox in use' warning. To clear this, you have to delete owner.lok.
I'm trying to write a batch file which tries to delete owner.lok and then runs eudora. This works unless owner.lok is genuinely in use by another copy of eudora, when DOS correctly gives a sharing violation (error 32 i think) and abort/r/f, requiring manual response. What I want it to do is carry on & run Eudora so that Eudora can put up its 'in use' warning. How can I stop the batch file jamming here? I've tried:
echo a | del h:\eudora\owner.lok
and:
echo f | del h:\eudora\owner.lok
as given at
http://computing.net/dos/wwwboard/forum/2711.html

Here's the file so far:

if exist h:\eudora\owner.lok goto wipelok
goto runeud
:wipelok
echo f | del h:\eudora\owner.lok
if errorlevel 1 goto runeud
:runeud
start /max d:\progra~1\qualcomm\eudora\Eudora.exe h:\eudora
@echo off
cls
---------

Could I maybe detect that owner.lok is currently off-limits without triggering the error?
Grateful for any help

Tim



Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: July 11, 2002 at 12:38:29 Pacific
Reply:

COMMAND.COM has many undocumented switches. One of them is the /F switch, which responds FAIL to such questions.

So, instead of:

echo f | del h:\eudora\owner.lok

Use this:

%COMSPEC% NUL /F /C del h:\eudora\owner.lok

The %COMSPEC% variable stores the command interpreter (command.com) full path. The 'NUL' supresses the output.

Besides the /F switch, I've found 3 other undocumented switches for COMMAND.COM:

/D - Don't know what this one does yet
/T - Same as /P, but won't run AUTOEXEC.BAT
/Z - Display errorlevel after each command

There could be more, I'm no sure.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Response Number 2
Name: Tim Evans
Date: July 15, 2002 at 03:21:42 Pacific
Reply:

Leonardo, that does it. Thanks very much.

Tim


0
Reply to Message Icon

Related Posts

See More


Dos Networking! UI C Library



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Handle sharing violation in batch file

What does the % mean in batch files? www.computing.net/answers/dos/what-does-the-mean-in-batch-files/5925.html

Variables in batch files www.computing.net/answers/dos/variables-in-batch-files/12289.html

Choice in batch files on NT4-DOS www.computing.net/answers/dos/choice-in-batch-files-on-nt4dos/11474.html