Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to fabricate a "file in use" scenario. I am programming exception handling for this particular scenario but I am unable to come up with a way to put a file "in use" so other programs are unable to delete or modify it.

Is there a simple way to do this that I'm overlooking?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Try to open that file with Excel application. I do not remember what actions exactly it disallows, but deletion for sure.

share|improve this answer
    
Excel also seems to be particularly aggressive about not allowing other applications to access files it has open. –  dsolimano Oct 3 '12 at 1:54
    
Didn't work unfortunately. –  Joe Philllips Oct 3 '12 at 1:56
    
Then write couple of lines of C/C#/VB code :) –  Serge Oct 3 '12 at 2:01
1  
Actually Excel does the trick! –  Joe Philllips Oct 3 '12 at 2:02
    
@dsolimano repost your advice as answer please –  Serge Oct 3 '12 at 2:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.