Why is osk.exe reported as not existing and does not start?

1.2k Views Asked by At

I see the following in the Explorer:

enter image description here

Now I try to run it using

Shell "C:\Windows\System32\osk.exe", vbNormalFocus

It fails, saying "File not found".

I am confused.

I call:

Shell "C:\Windows\SysWOW64\osk.exe", vbNormalFocus

The same error occurs.

When I use the following function to check for the existance, it also returns False.

Public Function FileExists(ByVal uPath As String) As Boolean

    Const NotFile = vbDirectory Or vbVolume
    
    On Error Resume Next
    FileExists = (GetAttr(uPath) And NotFile) = 0
    On Error GoTo -1
  
End Function

I am really baffled what might be going on here.

1

There are 1 best solutions below

0
user18521918 On

Windows has a feature for 32 bit programs only. To 32 bit programs C:\Windows\SysWOW64\osk.exe is exactly the same file as C:\Windows\System32\osk.exe (but not to 64 bit) and both refer to C:\Windows\SysWOW64\osk.exe.

So for a 32 bit program to access System32 it needs to use a special name - C:\Windows\SysNative\osk.exe. Note the file redirector will look after it - there is no folder of that name.

Using that path on a 64 bit program will cause an error. Only 32 bit programs need it and only they can use it.