The system cannot find the path specified.

I am trying to calculate the sha1 hash for some files from the% system% \ drivers \ using C # directory. I know the files are in the exact place, but when I use

FILE.Exists("c:\\Windows\\System32\\Drivers\\1394ohci.sys") 

it always reconfigures false.

 C:\Users\administrator>dir c:\Windows\System32\drivers\1394ohci.sys Volume in drive C has no label. Volume Serial Number is 5A4F-1E60 Directory of c:\Windows\System32\drivers 11/21/2010 08:53 AM 229,888 1394ohci.sys 1 File(s) 229,888 bytes 0 Dir(s) 19,521,245,184 bytes free C:\Users\administrator>fciv -sha1 c:\Windows\system32\drivers\1394ohci.sys // // File Checksum Integrity Verifier version 2.05. // c:\windows\system32\drivers\1394ohci.sys\* Error msg : The system cannot find the path specified. Error code : 3 

I even tried fciv.exe in a file and it also generated the same result. I tried running the command as an administrator, but that did not help.

I did a lot of web searches, but nothing worked. Please help and let me know how to fix this problem.

Appreciate your help. Thanks,

+4
source share
4 answers

If I understand your problem correctly, you need to look at File File Redirector

The% windir% \ System32 reserved directory for 64-bit applications. Most DLL file names were not changed when 64-bit versions of the DLL were created , so 32-bit versions of the DLL are stored in a different directory . WOW64 hides this difference using a system redirector file.

In most cases , when a 32-bit application tries to access% windir% \ System32, access is redirected to% windir% \ SysWOW64 . Access to% windir% \ lastgood \ system32 is redirected to% Windir% \ lastgood \ SysWOW64. Access to% windir% \ regedit.exe was redirected to% windir% \ SysWOW64 \ regedit.exe.

There is also a small selection at the bottom of the page, if you can try this

 string system32Directory = Path.Combine(Environment.ExpandEnvironmentVariables("%windir%"), "system32"); if(Environment.Is64BitOperatingSystem && !Environment.Is64BitProcess) { // For 32-bit processes on 64-bit systems, %windir%\system32 folder // can only be accessed by specifying %windir%\sysnative folder. system32Directory = Path.Combine(Environment.ExpandEnvironmentVariables("%windir%"), "sysnative"); } 
+4
source

Run the program in administrator mode.

0
source

As already mentioned, this is a file system redirector at work. The workaround is to replace system32 with sysnative in the file path.

This also infuriated me, and it took too much work to find a simple workaround. I continued to land on pages with advanced scripts and complex, obscure tangent solutions. So I decided to share the "easy mode".

0
source

From http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx :

The Exists method returns false if any error occurs while trying to determine if the specified file exists. This can occur in situations that cause exceptions, such as sending a file name with invalid characters or too many characters, a failed or missing drive, or if the calling device does not have permission to read the file.

-1
source

Source: https://habr.com/ru/post/1389870/


All Articles