Results 1 to 7 of 7

Thread: Question with the way vb.net starts and uses cmd prompt

  1. #1

    Thread Starter
    Lively Member kshadow22's Avatar
    Join Date
    Dec 2014
    Location
    Kentucky
    Posts
    95

    Question with the way vb.net starts and uses cmd prompt

    When I go to run services and programs through command prompt, they all work like they should. For example, start msconfig will open the configuration utility offered by windows. However, if I use process.start("msconfig") or try to open a batch file that runs msconfig, I get errors thrown back at me. I have searched for answers myself and cannot figure out how and why running a batch file will not run msconfig. To me, I would think msconfig would run- just like it does when I run it in command prommpt without a batch file. I do not need admin priviledges to do this either. I have everything set without it. I know thats not the problem. Any information would be awesome. I'm asking for just some general information or tips.

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

    Re: Question with the way vb.net starts and uses cmd prompt

    Quote Originally Posted by kshadow22 View Post
    However, if I use process.start("msconfig") or try to open a batch file that runs msconfig, I get errors thrown back at me.
    Definitely a good idea that you don't tell us what those errors are.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Fanatic Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    774

    Re: Question with the way vb.net starts and uses cmd prompt

    Your searching should have found this:

    http://www.vbforums.com/showthread.p...n-msconfig-exe

    This seems to work if running as administrator:

    Code:
    Process.Start("C:\Windows\Sysnative\msconfig.exe")
    I have only tested it on Windows 10 64-bit.

  4. #4

    Thread Starter
    Lively Member kshadow22's Avatar
    Join Date
    Dec 2014
    Location
    Kentucky
    Posts
    95

    Re: Question with the way vb.net starts and uses cmd prompt

    Quote Originally Posted by jmcilhinney View Post
    Definitely a good idea that you don't tell us what those errors are.
    Sorry, the errors that I receive tell me that the program does not exist. However, I am able to execute msconfig by running it as a task using (win + r), command prompt using "start msconfig", and creating a batch file with "start msconfig" as the script (but when running it as a batch file, this does not work when I process.start the batch file from the program. It throws me an error saying windows cannot find the program. I've also tried the following codes individually.
    Code:
    Process.start("msconfig")
    Process.start("c:\windows\system32\msconfig.exe")
    Here are the pictures of the errors.
    Attachment 163227
    Attachment 163229

  5. #5

    Thread Starter
    Lively Member kshadow22's Avatar
    Join Date
    Dec 2014
    Location
    Kentucky
    Posts
    95

    Re: Question with the way vb.net starts and uses cmd prompt

    Quote Originally Posted by paulg4ije View Post
    Your searching should have found this:

    http://www.vbforums.com/showthread.p...n-msconfig-exe

    This seems to work if running as administrator:

    Code:
    Process.Start("C:\Windows\Sysnative\msconfig.exe")
    I have only tested it on Windows 10 64-bit.
    Yes, I read everything from this forum already, it was one of the firsts that I found. I applied all of the information and code to my program, and still no luck. I get an error saying that the system cannot find the program. When I look at the msconfig directory, it is located at c:\windows\system32\msconfig.exe, however, the system tells me it cannot find it only when trying to execute it through the application.
    Name:  MSconfig_error.jpg
Views: 320
Size:  17.1 KB

  6. #6

    Thread Starter
    Lively Member kshadow22's Avatar
    Join Date
    Dec 2014
    Location
    Kentucky
    Posts
    95

    Re: Question with the way vb.net starts and uses cmd prompt

    IT seems to me like there is some sort of security or admin issue going on, something deeper than the system just not finding the program. I just don't have enough knowledge to figure it out.

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Question with the way vb.net starts and uses cmd prompt

    Have you tried all of the recommendations from the other thread?

    You should be:
    • using Sysnative,
    • running your application as Admin (right-click on the executable, or right-click on the Visual Studio shortcut to open it as admin),
    • and changing your build configuration target from x86 to Any CPU.


    If doing all of those doesn't work, it would be a good idea to tell us what version of Windows you are using.

Tags for this Thread

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