【问题标题】:cannot find osk.exe [duplicate]找不到 osk.exe [重复]
【发布时间】:2019-06-02 17:38:42
【问题描述】:

我正在尝试使用 c# 启动屏幕键盘。我需要它在 32 位机器上启动。我正在运行 win 10。到目前为止,我已经尝试过

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");

每次我得到 System.ComponentModel.Win32Exception: '系统找不到指定的文件'

我已经在网上尝试了所有方法,但没有任何效果。我知道 osk 在那里,因为我正在运行它,我只是无法通过 c# 启动它。 这必须运行的机器是 32 位工业 PC,我无法将机器配置为运行 x64。

【问题讨论】:

  • Process.Start(@"%windir%\system32\osk.exe"); 尝试使用完整路径?比如Process.Start(@"C:\Windows\system32\osk.exe");
  • 试过了也没用
  • 其中有一个名为 WinSxS 的新文件夹,其中有 osk.exe 我在路径“C:\Windows\WinSxS\amd64_microsoft-windows-osk_31bf3856ad364e35_10.0.18362.1_none_7d1a4367d7272061\osk.exe”中找到了我的一个您还可以使用 windows 文件夹中的搜索选项来查找其他版本的 osk.exe 。您不能使用 system32,因为权限受到限制

标签: c# system.diagnostics process.start on-screen-keyboard


【解决方案1】:

所以这对我有用,但我在 x64 机器上:

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

如果我将 Platform target 设置为 x86,它不起作用,但如果我将它设置为 Any CPU 并且更喜欢 32 位它会起作用(在构建属性下)。

【讨论】:

    猜你喜欢
    • 2012-01-31
    • 2013-09-10
    • 2014-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-04
    • 2017-05-22
    • 2011-04-14
    相关资源
    最近更新 更多