5

I'm working on a batch file in Windows 7 Ultimate. I'm using notepad++ with the runme extension.

When I run the batch file and make some changes directly after that, I am not able to save the .bat file, because windows says it's been used by another process.

So I need to wait about 60 seconds until I'm able to re-save the file to test the changes.

Same goes when using the built-in Notepad.

Strangely I can delete the .bat file directly after running it, but saving doesn't work.

Some months ago, when I was working on another batch-file, everything was working ok.

Is there any way to stop this strange behaviour? Or is there at least any way to see which process is blocking the file?

1 Answer 1

8

Solution

The problem happens when the Application Experience service (AeLookupSvc) is disabled:

If the Application Experience service has been disabled, [Windows] Explorer may hold on to an executable file handle lock for an extended time.

Source: Linker Tools Error LNK1168

  1. Open an elevated command prompt.
  2. Type or paste the following command:

    sc config "AeLookupSvc" start= demand
    
  3. Restart Windows.

Additional information

The Application Experience service (AELookupSvc) is a part of the Application Compatibility Administrator. It processes application compatibility lookup requests for applications as they are started, provides support for computers running programs in compatibility mode, reports on compatibility issues, and automatically applies software updates to programs.

The Application Experience service must be active for application compatibility software updates to be applied. You cannot customize this service; the operating system uses it internally. [...]

If you disable the Application Experience service, the service continues to run, but no calls are made to the service. You cannot stop the actual process.

The Application Experience service is configured for a Manual start.

Source: Threats and Countermeasures Guide: System Services

Application Compatibility attempts to check if the .EXE file requires any application compatibility shims when it is accessed. This causes the system to obtain a handle to the file. The system queues a lookup request to the Application Experience (AeLookupSvc) service, but since the service is disabled, the request is not serviced in time and the file [cannot be accessed] because it is in use. After two minutes, the queued request to the Application Experience service times out and is dropped, releasing the handle.

Source: Copying .EXE files may result in a sharing violation error - Folder In Use

3
  • 1
    Wow, this solved the problem.
    – evilheinz
    Apr 14, 2014 at 12:28
  • 1
    I must have disabled this service in msconfig some time ago when I was checking for unnecessary services. Now that I enabled it, everything is fine again, yay!
    – evilheinz
    Apr 14, 2014 at 12:34
  • 3
    @evilheinz Yeah, I've disabled the same service by mistake once, and I was getting the same issue. Anyway, if you want to tweak services through a GUI, avoid msconfig.exe and use services.msc instead. This way you won't be able to disable critical services, and you have a greater control over startup types and other settings, whereas the system configuration utility can just disable or re-enable services.
    – and31415
    Apr 14, 2014 at 13:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .