Windows CE: Adding two files of the same name to two different folders in the file system.

Here’s the deal… You are building a Windows CE operating system image that includes a bunch of files that need to be mapped to different folders in the file system – it could be that you are adding a web site for remote configuration of the Windows CE device, in which case files need to be mapped to the \Windows\www\wwwpub folder, and perhaps sub-folders that live under the wwwpub folder. In which case there’s the possibility that you might have two (or more files) of the same name, perhaps “default.htm” or “background.png”, or whatever.

Since files that are included into the Windows CE operating system image are initially mapped to the \Windows folder and need to be cloned/copied out to other folders (using everyones favorite .DAT files!) you have a problem, you can’t have two different background.jpg files in the \Windows folder.

So how to work around the issue?

One way to work around the issue is to map your conflicting files into the \Windows folder under different names, perhaps “background-1.png” and “background-2.png”, or perhaps even more useful would be to use GUIDs for the filenames! “FEF03A6B-16DD-43cc-968D-DA4EF0E8A592.png” for example (kidding!!).

Since the Windows CE build system requires the files to be placed into the _FLATRELEASEDIR (build folder for the project) you should rename the files before copying to the _FLATRELEASEDIR (and of course keep a note of which file is which).

Once the files are in the _FLATRELEASEDIR you then need to include the files into the operating system image – this is handled by a .BIB file – here’s a sample – in this sample I have two text files, both should be called “Fox.txt”, the contents of the files are different, and will need to be mapped to different folders in the final image.

; Copyright (c) 2008 Microsoft Corporation.  All rights reserved.
; NOTE: if any of the .EXE's included in this component are .NETCF
; you will need to move them to the FILES section.
;  Name            Path                            Memory Type
;  --------------  ------------------------------  -----------

;  Name            Path                            Memory Type
;  --------------  ------------------------------  -----------
fox1.txt    $(_FLATRELEASEDIR)\fox1.txt            NK
fox2.txt    $(_FLATRELEASEDIR)\fox2.txt            NK


If I were to build the operating system at this point I would have two text files in the \Windows folder, one called fox1.txt, the other called fox2.txt (see below).


I now need to map the files from the \Windows folder to the folders I need for my custom device image – in this case I will create a \Demo folder, and two sub-folders, one called “FirstFox”, and the second called “SecondFox” – the cunning plan is to have each folder contain a file called “fox.txt” (which contains the text “The quick brown fox jumps over the lazy dog”, and “*** Modified *** The quick brown fox jumps over the lazy dog” [the contents of the files are different so it’s easy to tell them apart]).

We use a .DAT file to map (and optionally rename) files from the \Windows folder to the destination folder – see the sample below.



And here’s how the final folder structure looks for the running device image.


Fairly straight forward to rename/map files into the appropriate place – perhaps this is functionality I should add to the CEFileWiz application…

– Mike

Comments (5)

  1. Glen Gordon (not the MS one.) says:

    I’ve always been confused as to what happens when files are remapped by .dat files.  Is this equivalent to simply copying them into the destination location or is there some optimization such that a mapped file is functionally hard-linked to the original one so you don’t pay the penalty of twice the storage space being used?

  2. Rahul says:


    I want to Add my applications to exsting OS Image,

    It will be like replcaing Or Adding new Folders.

    So Can you tell me how to add New Application in Os Image. Wher should I make chages also can you tell me Win CE Build System & Directory Structure.

    Waitingfor the reply,

    Thanks & Regards,


  3. Helge Kruse says:


    You wrote that the build system requires files to be placed into the _FLATRELEASEDIR. But I experienced that you can also add a directory name in the BIB file and refer to files at any location.

    So it should be possible to perform the rename in the BIB file, when you refer the original file name at the original location and define a different file for the WinCE image.

    Of course the step with the .DAT file will be necessary anyway.

    Regards, Helge

  4. Based on some recent blog comments I wanted to add some additional information to the existing Windows

  5. Based on some recent blog comments I wanted to add some additional information to the existing Windows

Skip to main content