简体   繁体   English

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

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

I'm trying to launch the MultiDigiMon (Multiple digital monitors) utility as part of an automatic calibration scheme.我正在尝试启动 MultiDigiMon(多数字监视器)实用程序作为自动校准方案的一部分。

I can launch it manually by running "multidigimon -touch" (note: that if you don't have any touch devices it wont launch for you, but the file is still in the system32 folder).我可以通过运行“multidigimon -touch”手动启动它(注意:如果您没有任何触摸设备,它不会为您启动,但该文件仍在 system32 文件夹中)。 I can launch the cmd.exe utility just fine.我可以很好地启动 cmd.exe 实用程序。

Here is how I'm trying to do it:这是我尝试的方法:

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

It will just fail with the exception (when you run it):它只会因异常而失败(当您运行它时):

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

Weirdly enough, if you run it via debug or release, it won't throw a runtime exception, it just won't open the utility.奇怪的是,如果您通过调试或发布运行它,它不会抛出运行时异常,只是不会打开实用程序。

Administrator privileges make no difference.管理员权限没有区别。 64-bit Windows 10. 64 位 Windows 10。

I've tried:我试过了:

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

Error in Process.Start() -- The system cannot find the file specified Process.Start() 中的错误——系统找不到指定的文件

Update更新

So, I did some testing and the reason you're getting the error "can't find the file" is because when running 'un-elevated' it's not able to find the file.所以,我做了一些测试,你得到错误“找不到文件”的原因是因为在运行“未提升”时它无法找到文件。 I'm unsure still why you aren't able to run it elevated but I was able to run it using the code below.我仍然不确定为什么您无法提升运行它,但我能够使用下面的代码运行它。 My config is set as "Any-CPU".我的配置设置为“Any-CPU”。

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

Original原来的

Did you try the answer on the first referenced post?您是否尝试过第一个引用帖子的答案

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

In 64-bit Os, If you want to use exe in System32 folder, see this:在 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