Why would os.path.exists(“C:\\\\windows\\\\system32\\\\inetsrv\\\\metaback”) return False even when it exists?

故事扮演 提交于 2019-12-05 02:36:49

This is redirection of system folders at work. When a 32-bit process is running on a 64-bit version of Windows and uses the path %WINDIR%\System32, Windows substitutes %WINDIR%\SysWow64.

The function is returning false to tell you that C:\windows\syswow64\inetsrv\metaback does not exist, and it most likely is absolutely correct.

Try instead:

os.path.exists("C:\\windows\\sysnative\\inetsrv\\metaback")

Windows x64 security is quite a bit tighter than windows x86; especially under the current release OSes (7, 2008).

Sounds like your script doesn't actually have the permissions it needs to run. Generally speaking MS locked down quite a few directory paths (like c:\inetpub) which require elevated priviledges in order to perform any actions.

There are huge reasons for this and it's generally considered a very good thing.

I believe you'll want to mark your script (or whatever executes it) as "Run as administrator" in order to give it the elevated control. Of course, this may require you to confirm execution via the UAC.

For further information, go to serverfault.com and ask there.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!