Corflags.exe cf001 Could not open file for wiriting

7.3k Views Asked by At

I am trying to edit the corflags file so that I can run 32bit applications on a 64 bit pc but everytime I try to edit the file using something like corflags.exe assembly /32bit+ it comes up with the error message cf001 could not open file for writing.

Now I have tried a lot of different options such as:

  • Running in administrator mode;
  • Finding the file using a search and checking read only is not ticked
  • Checking that user full control is ticked
  • Tried to set the whole folder to non read only

When trying the whole folder, it goes through looking like it has set read-only, but then I click OK and re-right click on the whole folder, the box is filled in (not ticked) does this mean that part of the folder is read only and why does it reset to read only?

3

There are 3 best solutions below

0
On

I just faced the same problem and have tried the same things.

Run cornflags from an elevated ("Run as administrator") Visual Studio Command Prompt. I did the same for a copy of the original .exe just to make sure no other process was using the program.

0
On

I realise this is years later, but for anyone else looking, I found that the quickest way was to copy cmd and corflags.exe into the same folder as the one you want to edit. Then run cmd as admin from there.

0
On

Create a copy of the file you intend to target with CorFlags. (e.g. "WcfServiceHost.exe" --creates--> "WcfServiceHost - Copy.exe")

Rename the original file to something else: (e.g. "WcfServiceHost.exe" --> "WcfServiceHose_Original.exe")

Rename to copy to the original file name (e.g. "WcfServiceHose - Copy.exe" --> "WcfServiceHost.exe"

For my purposes, I created copies and named them describing their configuration: Example: WCFServiceHost_With32BitOn.exe WCFServiceHost_With32BitOff.exe

Now I can destroy the WCFServiceHost.exe files and create them from these pre-modified copies. No more CorFlags operations necessary.

Note: this is basically a more verbose version of @RMalke answer and that answer should be marked as the answer.