Page 1 of 1
Help with FILE()
Posted: Mon Aug 09, 2010 2:45 am
by tsai8839
I use function FILE() as below, it works fine with windows XP, but it executes MsgStop() function with windows 7. On the other words, the FILE() tell me CMD.EXE file does not exist, but it is exist in fact.
FUNCTION Main()
LOCAL cFile := GetSysDir() + "\CMD.EXE"
IF ! FILE( cFile )
MsgStop( "File does not exist!", "Warning" )
ENDIF
RETURN(NIL)
Any help will be much appreciates.
Andy
Re: Help with FILE()
Posted: Mon Aug 09, 2010 4:54 am
by anserkk
Your sample is working fine on my PC running OS Windows 7 - 32 BIT.
Please check the file attribute of the file cmd.exe in your C:\Windows\System32 folder
Regards
Anser
Re: Help with FILE()
Posted: Mon Aug 09, 2010 5:57 am
by tsai8839
Thank you Anser, my PC running OS Windows 7 - 64 bit.
Is this cause the problem?
Regards,
Andy
Re: Help with FILE()
Posted: Mon Aug 09, 2010 6:48 am
by anserkk
Sorry, as of now I don't have a Windows 7 - 64 bit here. Are you experiencing the same problem with files other than cmd.exe ?
Did you check the output of the function GetSysDir() and is it returning the expected output ?
Regards
Anser
Re: Help with FILE()
Posted: Mon Aug 09, 2010 7:41 am
by tsai8839
Anser,
Yes, I have the same problem with files other than cmd.exe, and the function GetSysDir() returns C:\Windows\System32
Regards,
Andy
Re: Help with FILE()
Posted: Mon Aug 09, 2010 7:49 am
by driessen
Andi,
Is GetSysDir() returning "C:\Windows\System32" or is it returning "C:\Windows\System32\" ?
In the second case your test would result into "C:\Windows\System32\\cmd.exe", which, of course, doesn't exist.
Re: Help with FILE()
Posted: Mon Aug 09, 2010 1:47 pm
by tsai8839
Michel,
The result is "C:\Windows\System32\cmd.exe".
So far as I know, the path is correct, the file is exist. But the result of file() is .F.
I don't know how to fix this problem. Do you have any idea?
Regards,
Andy
Re: Help with FILE()
Posted: Mon Aug 09, 2010 2:36 pm
by Patrizio
tsai8839 wrote:Michel,
The result is "C:\Windows\System32\cmd.exe".
So far as I know, the path is correct, the file is exist. But the result of file() is .F.
I don't know how to fix this problem. Do you have any idea?
Regards,
Andy
Andy, do you have correct rights to access to a system dir? Try to execute the test as administrator.