Skip to content
⌘ NSIS Forum Archive

IfFileExists not working on win 7?

7 posts

bennaloz#

IfFileExists not working on win 7?

I have to make a backup of a patch. So I check every file of the patch if exists on the current installation and if it exists I save it and if it doesn't exist I write its path in a file.
Anyway I made it on win xp and it works fine but after, when I tried it on win 7 it didn't work. It seems that every file doesn't exist. I checked the correctness of the path and every path is correct but if the file exists it doesn't copy it like I want but it write every path in the file as if the file doesn't exist. What is the problem? or what could be the problem...

bennaloz
bennaloz#
aaah you're right.Paths of mine are something like C:\programs\... Maybe I have to use $PROGRAMFILES to make it work with all platforms or $PROGRAMFILES32? I'm sorry it was a pretty stupid question I didn't think about the OS because I used in every path the install dir read from the registry. Except 2 paths 🤪
bennaloz#
In general I need to achieve the install directory of an application installed in any pc. I thought to read the install directory from the registry and it could work in every windows OS. But in XP it works and in 7 seems not. Patch files have been extracted in $TEMP\myfolder. Anyway I think I understood what the problem is. I used for some paths C:\programs\myapp\ for XP. But in win 7 I need C:\program files\myapp if it is x32 or C:\program(x86) if it is x64. My application is a x32 application so should I use $PROGRAMFILES32? I hope I was clear in my explanation
bennaloz#
problem solved sorry for the stupid thread. 🙁 ♻️
I simply read from the registry the path of the installation directory and it changes in according to the operating system. I could also use $PROGRAMFILES/$PROGRAMFILES32 that's the same but reading from the RegKey I have the complete path so it's more convenient