Recently Browsing 0 members
No registered users viewing this page.
I want to check if a file exists under the System32 folder: C:\Windows\System32\inetsrv\rewrite.dll
The following code always worked for me:
$string = @SystemDir & "\inetsrv\rewrite.dll" ConsoleWrite(FileExists($string)) But yesterday I updated my Windows 10 with the last "big" update and now my @SystemDir returns the following string:
And before it was:
So I thought I change my code to:
$string = @WindowsDir & "\System32\inetsrv\rewrite.dll" ConsoleWrite(FileExists($string)) But this code also does not work. I tried to run it as administrator but this also didn't work.
What am I doing wrong?
Have the following code snippet:
If not FileExists($ExchangeDir & $StockCSV) Then _FileWriteFromArray($ExchangeDir & $StockCSV, $YahooStockEntries) Else When trying to do a check against the non-existent file 'PRN.csv', FileExists is evaluating as True. This is not happening with other file names, directory structure is correct.
I went searching for something to speed up checking for files on the network (UNC Paths)
Most examples were rather complicated but someones multi-threaded solution gave me an idea.
Hope it is useful to someone.
Seems to work well so far.
Func _FileExistsTimeout($sPath, $iTimeout = 1000) Local $hTimer = TimerInit() ; Begin the timer and store the handle in a variable. Local $iPID = Run(@AutoItExe & ' /AutoIt3ExecuteLine "ConsoleWriteError(FileExists(""' & $sPath & '""))"', @ScriptDir, @SW_HIDE, $STDERR_CHILD) Local $sOutput = "" Local $iDiff = 0 While $iDiff < $iTimeout $iDiff = TimerDiff($hTimer) $sOutput &= StderrRead($iPID) If @error Then ; Exit the loop if the process closes or StderrRead returns an error. ExitLoop EndIf WEnd ProcessClose($iPID) Switch StringStripWS($sOutput, 8) Case 1 Return True Case Else Return False EndSwitch EndFunc ;==>_FileExistsTimeout
Prior to posting this question, I have experimented with using FileExists, InetGetInfo and InetGet/InetClose functions to test downloading files into my application folder, in case if my file did not already exist.
In my case, I was able to pinpoint to a very specific web address, eg.) https://dropbox.com, etc. and then check/download the file.
Now my question is, instead of checking from a hardcoded URL, is it possible to:
1. Do a check against the IP address of a remote computer, eg.) my friend's or colleague's desktop computer
2. After checking the IP address if valid and can be connected to, access the computer's hard drive location, eg.) that machine's C:specifiedFolderspecifiedFile.txt
3. Download a copy of that file into a local computer
I did read ('?do=embed' frameborder='0' data-embedContent>>) but that was what I accomplished earlier, so now I am not sure if I were to change the method of file retrieval, what changes are necessary?
Why is it that if you send the function FileExists with a path that has quotes around it, for example see below, it tells you that the file/path doesn't exist?
$drive = """C:""" ;$drive = "C:" Doesn't work ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $drive = ' & $drive & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console If FileExists($drive) Then MsgBox(4096, $drive & " Dir ", "Exists") Else MsgBox(4096, $drive & " Dir ", "Does NOT exists") EndIf $drive1 = "C:" ; $drive1 = C: Works ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $drive1 = ' & $drive1 & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console If FileExists($drive1) Then MsgBox(4096, "C: Dir ", "Exists") Else MsgBox(4096, "C: Dir", "Does NOT exists") EndIf If you're using FileExists with path names that you've put quotes around to work with other functions, you either have to check for the file before putting the quotes, or stripping them off before checking, which seems a little backwards. Not sure if I should report this as a bug, or something to add to the help file.