繁体   English   中英

C# 进程 - 找不到“MultiDigiMon”exe 实用程序

[英]C# Processes - cannot find "MultiDigiMon" exe utility

我正在尝试启动 MultiDigiMon(多数字监视器)实用程序作为自动校准方案的一部分。

我可以通过运行“multidigimon -touch”手动启动它(注意:如果您没有任何触摸设备,它不会为您启动,但该文件仍在 system32 文件夹中)。 我可以很好地启动 cmd.exe 实用程序。

这是我尝试的方法:

        ProcessStartInfo info = new ProcessStartInfo(@"C:\Windows\System32\MultiDigiMon.exe", "-touch");
        Process.Start(info);

它只会因异常而失败(当您运行它时):

Unhandled Exception: System.ComponentModel.Win32Exception: The system cannot find the file specified
   at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at CommandLineTest.Program.Main(String[] args) in C:\Users\-\Program.cs:line 20

奇怪的是,如果您通过调试或发布运行它,它不会抛出运行时异常,只是不会打开实用程序。

管理员权限没有区别。 64 位 Windows 10。

我试过了:

Process.Start in C# The system cannot find the file specified error

Process.Start() 中的错误——系统找不到指定的文件

更新

所以,我做了一些测试,你得到错误“找不到文件”的原因是因为在运行“未提升”时它无法找到文件。 我仍然不确定为什么您无法提升运行它,但我能够使用下面的代码运行它。 我的配置设置为“Any-CPU”。

ProcessStartInfo info = new ProcessStartInfo(@"C:\Windows\Sysnative\MultiDigiMon.exe", "-touch");
info.WorkingDirectory = @"C:\Windows\Sysnative\";
info.UseShellExecute = true;
Process.Start(info);

原来的

您是否尝试过第一个引用帖子的答案

ProcessStartInfo info = new ProcessStartInfo(@"C:\Windows\sysnative\MultiDigiMon.exe", "-touch");

在 64 位操作系统中,如果要使用 System32 文件夹中的 exe,请参见:

PVOID OldValue = NULL;
BOOL bRet = Wow64DisableWow64FsRedirection(&OldValue);
ShellExecute(NULL, _T("open"), _T("C:\\Windows\\System32\\MultiDigiMon.exe"), _T(" -touch"), NULL, SW_SHOWNORMAL);
if (bRet)
{
    Wow64RevertWow64FsRedirection(OldValue);
}
else
{
    LOG_ERROR("Wow64DisableWow64FsRedirection failed!!!");
}
OldValue = NULL;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM