Results 1 to 9 of 9

Thread: Trying to open MRT.exe from system32

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2018
    Posts
    13

    Post Trying to open MRT.exe from system32

    Trying to open the application MRT.exe from within the System32 directory.

    If I use for example to open Notepad, works fine.
    Code:
    Process.Start("C:\Windows\System32\Notepad.exe")
    This however, keeps saying file not found, yet sits clearly in Windows 10 System32 directory
    Code:
    Process.Start("C:\Windows\System32\MRT.exe")
    I know I shouldn't be using the C:\..... But I didn't know how to call the Windows + System32 directory any other way.

    If the file requires admin rights, how can I run that file.

    The MRT.exe is on 90% of everyone's computer.

    Thank you.
    Last edited by GeGeek; Feb 23rd, 2018 at 10:06 PM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,347

    Re: Trying to open MRT.exe from system32

    Can you type that same path into a console window and execute the intended application? If so then what may well be happening is not that it can't find the file you're trying to execute but that that application can't find a file that it wants to use.

    When you run an application from the console, the working directory for the process is the folder that contains that EXE. Some applications assume that that will be the case and just try to access a file in their working directory. When you call Process.Start as you are, the working directory for the new process is the same as for your app, so the file that the other application is looking for will not be found there. To remedy that, start by creating a ProcessStartInfo and set the file name and working directory, then pass that to Process.Start.

    You should be able to get the system32 folder path or a root folder path using the Environment.GetFolderPath method.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2018
    Posts
    13

    Re: Trying to open MRT.exe from system32

    Can you give me an example please?

  4. #4
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,140

    Re: Trying to open MRT.exe from system32

    Hard-coded paths are a bad idea. Setting that aside, this is going way back in the cobweb area of my memory. If the VB.NET program you are creating is a 32-bit program, and the Operating system is 64-bit, then Windows might be automatically routing your attempt to access C:\Windows\System32\MRT.exe over to C:\Windows\SysWOW64\MRT.exe, which likely doesn't exist.

    If so, try:

    Code:
    Process.Start("C:\Windows\Sysnative\MRT.exe")

  5. #5
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,398

    Re: Trying to open MRT.exe from system32

    Any application trying to launch inside system32 has no business doing so.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,347

    Re: Trying to open MRT.exe from system32

    Quote Originally Posted by GeGeek View Post
    Can you give me an example please?
    I gave you the relevant keywords. Now I expect you to use those keywords to find what information you can for yourself and then put it to use. If you still can't get it to work, then you should post back again with what you've tried and explain what happened when you tried it. There are already examples of just about everything on the web already. There's no need for me to provide yet another when you have the means to find those.

  7. #7

    Thread Starter
    New Member
    Join Date
    Jan 2018
    Posts
    13

    Re: Trying to open MRT.exe from system32

    So I've come back, I did try the following above and used

    Code:
    Process.Start("C:\Windows\Sysnative\MRT.exe")
    This doesn't work as I get an error:

    Name:  error.png
Views: 302
Size:  20.8 KB

    Yet I am able to run the following command:

    Code:
    Process.Start("C:\Windows\Sysnative\MRT.exe")
    Last edited by GeGeek; Feb 23rd, 2018 at 10:37 PM.

  8. #8
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,480

    Re: Trying to open MRT.exe from system32

    Code:
    Dim p As New Process
    p.StartInfo.FileName = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "MMC.exe")
    p.StartInfo.Arguments = "perfmon.msc"
    p.Start()

  9. #9

    Thread Starter
    New Member
    Join Date
    Jan 2018
    Posts
    13

    Re: Trying to open MRT.exe from system32

    Quote Originally Posted by .paul. View Post
    Code:
    Dim p As New Process
    p.StartInfo.FileName = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "MMC.exe")
    p.StartInfo.Arguments = "perfmon.msc"
    p.Start()
    Thanks Paul, that worked for the Perfmon, how can I use that for the Firewall and MRT?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width