1

I'm trying to launch the on screen keyboard with c#. I need it to launch on a 32 bit machine. I'm running win 10. Thus far I've tried

Process.Start(@"%windir%\system32\osk.exe");

Process.Start(@"C:\Users\mxrac\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessibilit\osk.exe");

Process.Start("osk.exe");

Each time I get System.ComponentModel.Win32Exception: 'The system cannot find the file specified'

I've tried everything online and can get nothing to work. I know the osk is there because I'm running it I just can't launch it via c#. The machine that this has to run on is a 32 bit industrial PC I cannot configure the machine to run x64.

Jeroen Heier
  • 3,520
  • 15
  • 31
  • 32
Mason White
  • 95
  • 2
  • 10
  • `Process.Start(@"%windir%\system32\osk.exe");` tried to use full path? something like `Process.Start(@"C:\Windows\system32\osk.exe");` for instance. – Bagus Tesa Jan 08 '19 at 03:29
  • tried it that didn't work either – Mason White Jan 08 '19 at 03:35
  • 1
    there is a new folder called WinSxS in it there is osk.exe i found mine one in path "C:\Windows\WinSxS\amd64_microsoft-windows-osk_31bf3856ad364e35_10.0.18362.1_none_7d1a4367d7272061\osk.exe" you can also use search option in windows folder to find other version of osk.exe . you cannot use system32 because the permission is restricted – Aditya Dand Nov 19 '19 at 16:42

1 Answers1

-1

So this worked for me, but I'm on an x64 machine:

    static void Main(string[] args)
    {
        ProcessStartInfo proc = new ProcessStartInfo("C:\\Windows\\System32\\osk.exe");
        proc.UseShellExecute = true;
        Process.Start(proc);
        Console.ReadLine();
    }

If I set Platform target to x86 it doesn't work, but if I set it to Any CPU and prefer 32-bit it does (under build properties).

Ben
  • 1,316
  • 1
  • 7
  • 11