FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Help with FILE()
Posts: 22
Joined: Mon Jul 24, 2006 06:45 AM
Help with FILE()
Posted: Mon Aug 09, 2010 02:45 AM

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

Regards,



Andy Tsai
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Help with FILE()
Posted: Mon Aug 09, 2010 04:54 AM

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

Posts: 22
Joined: Mon Jul 24, 2006 06:45 AM
Re: Help with FILE()
Posted: Mon Aug 09, 2010 05:57 AM

Thank you Anser, my PC running OS Windows 7 - 64 bit.
Is this cause the problem?

Regards,
Andy

Regards,



Andy Tsai
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Help with FILE()
Posted: Mon Aug 09, 2010 06:48 AM

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

Posts: 22
Joined: Mon Jul 24, 2006 06:45 AM
Re: Help with FILE()
Posted: Mon Aug 09, 2010 07:41 AM

Anser,

Yes, I have the same problem with files other than cmd.exe, and the function GetSysDir() returns C:\Windows\System32

Regards,
Andy

Regards,



Andy Tsai
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Help with FILE()
Posted: Mon Aug 09, 2010 07:49 AM

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.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 22
Joined: Mon Jul 24, 2006 06:45 AM
Re: Help with FILE()
Posted: Mon Aug 09, 2010 01:47 PM

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

Regards,



Andy Tsai
Posts: 90
Joined: Wed Nov 07, 2007 08:56 AM
Re: Help with FILE()
Posted: Mon Aug 09, 2010 02:36 PM
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.

Continue the discussion