Troy Seman - 2008-11-12

I was on here about a month ago with a problem where Dev C++ was reading a system variable, 'LIBRARY_PATH' that was causing a compile error. The solution was to use a shortcut, to open a batch file, which would then start Dev C++ with the 'LIBRARY_PATH' variable set to null for that instance of the Dev C++ compiler. The solution worked beautifully, however, the faculty and students don't always work so beautifully. ; - p

Faculty and students are used to opening the application simply by double clicking on the associated .c and .cpp source code files. The problem is that this bypasses the batch file that sets the system variable so the compiler will run. So, I set myself about the task of changing the file associations on the systems being used. And now, here's the rub...

I use a batch file to set the associations...
FTYPE DevCpp.c="C:\apps\Dev-Cpp\devcpp.bat" "%%1"
FTYPE DevCpp.cpp="C:\apps\Dev-Cpp\devcpp.bat" "%%1"
FTYPE DevCpp.dev="C:\apps\Dev-Cpp\devcpp.bat" "%%1"
FTYPE DevCpp.h="C:\apps\Dev-Cpp\devcpp.bat" "%%1"
FTYPE DevCpp.hpp="C:\apps\Dev-Cpp\devcpp.bat" "%%1"
FTYPE DevCpp.rc="C:\apps\Dev-Cpp\devcpp.bat" "%%1"
FTYPE DevCpp.template="C:\apps\Dev-Cpp\devcpp.bat" "%%1"

ASSOC .C=DevCpp.c
ASSOC .CPP=DevCpp.cpp
ASSOC .DEV=DevCpp.dev
ASSOC .H=DevCpp.h
ASSOC .hpp=DevCpp.hpp
ASSOC .rc=DevCpp.rc
ASSOC .template=DevCpp.template

I click on my 'C:\test.c' file and, as the batch file fires and Dev C++ opens, I get the following message... "Windows cannot find 'C:\test.c'. Make sure you typed the name correctly, and then try again. To search for a file click the Start button, and then click Search".

After this happens, my file associations reset to the default Dev C++ paths.

Now this should be some kind of Microsoft Windows problem but because of the whole reverting back to the original path thing, and because my batch file IS running and appears valid (I can copy paste the echoed output and run it again just fine) I thought this might be another entrenched Dev C++ behavior.

Could someone please help?

Here are the sordid details...

When I check using FTYPE command, after running the associations using the batch file, my relevant output is...
DevCpp.c=C:\Apps\Dev-Cpp\devcpp.exe "%1"
DevCpp.cpp=C:\Apps\Dev-Cpp\devcpp.exe "%1"
DevCpp.dev=C:\Apps\Dev-Cpp\devcpp.exe "%1"
DevCpp.devpackage=C:\apps\Dev-Cpp\PackMan.exe "%1"
DevCpp.devpak=C:\apps\Dev-Cpp\PackMan.exe "%1"
DevCpp.h=C:\Apps\Dev-Cpp\devcpp.exe "%1"
DevCpp.hpp=C:\Apps\Dev-Cpp\devcpp.exe "%1"
DevCpp.rc=C:\Apps\Dev-Cpp\devcpp.exe "%1"
DevCpp.template=C:\Apps\Dev-Cpp\devcpp.exe "%1"

After opening the associated 'C:\test.c' file the following batch file runs...
SET LIBRARY_PATH=
start "" "C:\Apps\Dev-Cpp\devcpp.exe" %1
pause

The echo output of this batch file is...

C:\Documents and Settings\supervisor\Desktop>SET LIBRARY_PATH=
C:\Documents and Settings\supervisor\Desktop>start "" "C:\Apps\Dev-Cpp\devcpp.exe" "C:\test.c"

C:\Documents and Settings\supervisor\Desktop>pause
Press any key to continue . . .

After the Windows error message clears my relevant FTYPE output is...

DevCpp.c=C:\Apps\Dev-Cpp\devcpp.exe "%1"
DevCpp.cpp=C:\Apps\Dev-Cpp\devcpp.exe "%1"
DevCpp.dev=C:\Apps\Dev-Cpp\devcpp.exe "%1"
DevCpp.devpackage=C:\apps\Dev-Cpp\PackMan.exe "%1"
DevCpp.devpak=C:\apps\Dev-Cpp\PackMan.exe "%1"
DevCpp.h=C:\Apps\Dev-Cpp\devcpp.exe "%1"
DevCpp.hpp=C:\Apps\Dev-Cpp\devcpp.exe "%1"
DevCpp.rc=C:\Apps\Dev-Cpp\devcpp.exe "%1"
DevCpp.template=C:\Apps\Dev-Cpp\devcpp.exe "%1"