LoWang

fileexists("C:\Documents and Settings") ??

11 posts in this topic

Hello somebody explain me this please

#AutoIt3Wrapper_Change2CUI=y
$l=FileExists("C:\Documents and Settings")
consolewrite("fileexist:"&$l&@crlf)
runwait('cmd.exe /c dir "C:\Documents and Settings"')

results into

fileexist:1
 Volume in drive C has no label.
 Volume Serial Number is CA10-DDF4

 Directory of C:\Documents and Settings

File Not Found

It's a windows server 2008 and the folder is NOT there. The same happens when I run this script on a windows 7 machine.

Share this post


Link to post
Share on other sites



The directory "C:\Documents and Settings" exists on my Windows 7 machine.
As you have read permission on C: function fileexists can find this directory.

With "Dir" you try to read the content of this directory. That fails because you do not have permission to read the content of the directory.
At least that's how it is here.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Are you sure that folder exists on your Win7? I have a feeling it may be just a NTFS link for backwards compatibility with apps which may not be using proper system variables. You can see it as a different icon in Total Commander. And my script has rights because I run it in an elevated command promtp.

What is the most reliable way to detect if the system is W2K8 or W2K3? Checking @OSArch macro? Or maybe checking for existence of c:\users folder...?

Edited by LoWang

Share this post


Link to post
Share on other sites

Yes, I'm sure. I checked it with Windows Explorer (removed the limitation to not display protected system files).

Or open a cmd window and try: dir C:\ /A:HS


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Use

ConsoleWrite(@OSVersion & @CRLF)

to retrieve information about the system you use.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

no :(
ERROR: _WinAPI_GetProfilesDirectory(): undefined function.

on my Windows 7 machine. Here they say I need to include <WinAPIFiles.au3>. Why don't I have it? AutoIt 3.3.8.1. Do I need newer version?

 

Share this post


Link to post
Share on other sites

_WinAPI_GetProfilesDirectory is included in the latest version of AutoIt (3.3.14.2).
Before you upgrade: But be aware that since 3.3.8.1 there have been a lot of script breaking changes!


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

You can also use something like this :

MsgBox(0, "", _ProfilesDir() )

Func _ProfilesDir()
    $iPreviousMode = Opt("ExpandEnvStrings", 1)
    $sRegVal = RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList", "ProfilesDirectory")
    $sProfilesDir = $sRegVal
    Opt("ExpandEnvStrings", $iPreviousMode)
    Return $sProfilesDir
EndFunc

 

1 person likes this

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

what is the purpose of this?

$iPreviousMode = Opt("ExpandEnvStrings", 1)

BTW I am not sure this line works as you think it does :-] If you can read the current Opt. This already sets it to 1 doesn't it?

Edited by LoWang

Share this post


Link to post
Share on other sites

The line sets the option to "1" BUT returns the status BEFORE it sets it to "1".


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now