No announcement yet.

File.DoesExist does not seem to be working for some reason...

  • Filter
  • Time
  • Show
Clear All
new posts

  • File.DoesExist does not seem to be working for some reason...

    I'm simply trying to check for the following...

    if File.DoesExist(_SystemFolder.."\\ServerManagerCmd.exe") then
    I checked that the path is correct with a message box. I even hard coded the path, C:\Windows\system32\ServerManagerCmd.exe and that didn't work.

    The file is in place in the path displayed, but its just not finding it and I can't figure out why.

    Any ideas. I'm currently running into the issue on a Win Server 2008 R2.

    Thanks for any help!!

  • #2
    Just a guess: This is a 64-bit environment, right? So the _SystemFolder your AutoPlay application is using is not C:\Windows\system32 as you think, but C:\Windows\SysWOW64. Attempts to access the 64-bit system folder will be redirected.



    • #3
      When I use _SystemFolder in the message box to see that I have the right path, it does display c:\windows\system32.

      Also, if I hard code c:\windows\system32\ServerManagerCmd.exe using File.DoesExist, it still doesn't find it.

      Or, are you saying, in either case, its getting redirected under the hood?


      • #4
        Yes, that is exactly what happens.



        • #5
          What make is even odder is that _SystemFolder.."\\ServerManagerCmd.exe" (File.Run) works fine from a button on the same page where the search for the file doesn't work.

          I'm stumped!


          • #6
            Originally posted by Ulrich View Post
            Yes, that is exactly what happens.

            So even if I specifically state the path as C:\Windows\System32 its redirected? That doesn't seem right to me. If that is true I can't, in essence, get to files in the system32 directory. File.Run seems to work fine with the path that isn't working for File.DoesExist.

            How then would I prevent the redirection to evaluate the path as entered?


            • #7
              See Wow64 Actions Plugin



              • #8
                Originally posted by Ulrich View Post
                I'm still confused as to why .Run works without the WOW64 PlugIn, but .DoesExist doesn't seem to function the same.

                I'll check out the PlugIn. I may be able to do away with the code snippet that isn't working properly but I hope to just get it to work as intended.


                • #9
                  After thinking about the Wow64 PlugIn, I went back and stared at my code for a while. The light bulb eventually went on. The File.Run was squeezed between some old Disable/Enable 64 bit redirect functions. I think these are part of a script I downloaded and incorporated a long, long time ago.

                  Once this was added to my problematic code, it worked flawlessly.

                  Even though it was staring me in the face, it took the mention of the Wow64 Plugin to get the wheels turning. I thank you for that.

                  Sorry to have wasted time with my oversight!!