Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Problem saving bat files after editing


  • Please log in to reply
2 replies to this topic

#1 GoshenBleeping

GoshenBleeping

  • Members
  • 264 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:05:44 AM

Posted 20 August 2015 - 08:02 PM

System: Windows 7 Home Premium SP1 64 bit
 
I was playing around with a bat file I created, trying to troubleshoot the file. The creation of the file and initial execution worked fine. But when I edited and then tried to save the file I received the following message:
 
"The process cannot access the file because it is being used by another process"
 
I then had to use Unlocker to kill the explorer process that was running on the folder containing the bat file. This makes for a very time consuming process of: launch unlocker to kill explorer process, edit bat file, save bat file, run bat file, launch unlocker to kill explorer process, edit bat file to fix error, etc.
 
Why does this happen? What am I missing? How can this be prevented?


BC AdBot (Login to Remove)

 


#2 JohnC_21

JohnC_21

  • Members
  • 24,291 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:05:44 AM

Posted 20 August 2015 - 08:32 PM

What happens in you press Crtl+break? You may need to press the fn key with a another key to get the break key. I don't have a lot of experience with batch files. Did you put an exit command in the .bat file. 

 

Depending on what you what to achieve you may have better results using Powershell. 



#3 tos226

tos226

    BleepIN--BleepOUT


  • Members
  • 1,574 posts
  • OFFLINE
  •  
  • Gender:Female
  • Location:LocalHost
  • Local time:05:44 AM

Posted 20 August 2015 - 09:41 PM

I would think that if you're editing a .bat file and attempt to run it while the editing window is open, then indeed the file is in use.

If my recollection is correct, then just edit the file. Close it. Then run it. That should work.

I, too, may be wrong. It's been a while since the last time I played with a .bat or .vbs file.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users