Trying to use Process.Start to launch msconfig but the OS can't find the file RRS feed

  • Question

  • I'm trying to create a launcher program for commonly used system utilities, display properties, msconfig, etc.  I've gotten everything to launch that I'm trying to shortcut, except for msconfig and gpedit.msc.  Granted the gpedit.msc probably won't work on my home system since it doesn't have a domain installation and won't see the gpedit.  However the msconfig, regardless of if I use Process.Start("msconfig") or Process.Start("C:\windows\system32\msconfig.exe") it throws an exception every time saying that it can't find the file.  If I launch it from the command prompt or run box, it fires off every time.  Any thoughts?  Thanks!
    • Edited by Stephen V Sunday, March 11, 2018 6:27 PM weird grammarly interaction
    Sunday, March 11, 2018 6:24 PM

All replies

  • Go to the Build settings of the project's properties. Be sure to set the "Configuration" to "All Configurations".  Assuming you have a 64-bit system, change "Platform target" to "x64". I don't know why that works. I don't know how to make the application work for both x86 and x64.

    Sam Hobbs

    Sunday, March 11, 2018 9:29 PM
  • You must disable Wow64 redirection :

    Dim bWow64 As Boolean = False
    IsWow64Process(System.Diagnostics.Process.GetCurrentProcess().Handle, bWow64)
    If (bWow64) Then
        Dim OldValue As IntPtr = IntPtr.Zero
        Dim bReturn As Boolean = Wow64DisableWow64FsRedirection(OldValue)
    End If

    with :

    <DllImport("Kernel32.dll", SetLastError:=True, CharSet:=CharSet.Unicode)>
    Private Shared Function IsWow64Process(ByVal hProcess As IntPtr, <Out> ByRef Wow64Process As Boolean) As Boolean
    End Function
    <DllImport("Kernel32.dll", SetLastError:=True, CharSet:=CharSet.Unicode)>
    Private Shared Function Wow64DisableWow64FsRedirection(<Out> ByRef OldValue As IntPtr) As Boolean
    End Function

    Sunday, March 11, 2018 9:44 PM
  • Sam,

    That worked.  Why does it interact with the directory structure differently when running x86 vs x64?

    Monday, March 12, 2018 12:19 AM
  • Hi Stephen V,

    The .exe file use some 64-bit assemblys, you need to use x64 platform to run the file. Or you will get the exception that you could not find the file.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 12, 2018 6:13 AM
  • you don't need x64, use the redirection as quoted above
    Monday, March 12, 2018 8:13 AM
  • Try this too (in C#):

    if( Environment.Is64BitOperatingSystem == Environment.Is64BitProcess )
       Process.Start( "msconfig" );
       var psi = new ProcessStartInfo
          FileName = "cmd",
          Arguments = @"/c ^""%SystemRoot%\Sysnative\cmd.exe^"" /c msconfig",
          UseShellExecute = false,
          CreateNoWindow = true,
       Process.Start( psi );

    Also check 'gpedit.msc'.

    If you are interested, try it under 32- and 64-bit Operating Systems (Windows 10).

    Monday, March 12, 2018 7:57 PM