简体   繁体   中英

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.

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). I can launch the cmd.exe utility just fine.

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.

I've tried:

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

Error in Process.Start() -- The system cannot find the file specified

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".

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:

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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