簡體   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