Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. better way for executing system commands [modified]

better way for executing system commands [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
comwindows-adminjsonquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    koumodaki
    wrote on last edited by
    #1

    I have a program which needs to disable/enable IIS Admin. I am doing the following int val = system("net stop iisadmin"); But this function pops-up the dos window and asks the user for confirmation. I do not want this window to appear [Basically the user of my program need not be aware that the IIS is being disabled and hence need not respond to the dos window] Is there some way to stop the dos window poping up and asking for confirmation? Is there any other command that can be used? Is there a better way of doing this operation? Can I obtain the instance of IIS by using COM api and disable it?

    _ J D 3 Replies Last reply
    0
    • K koumodaki

      I have a program which needs to disable/enable IIS Admin. I am doing the following int val = system("net stop iisadmin"); But this function pops-up the dos window and asks the user for confirmation. I do not want this window to appear [Basically the user of my program need not be aware that the IIS is being disabled and hence need not respond to the dos window] Is there some way to stop the dos window poping up and asking for confirmation? Is there any other command that can be used? Is there a better way of doing this operation? Can I obtain the instance of IIS by using COM api and disable it?

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      koumodaki wrote:

      I do not want this window to appear

      Did you try ShellExecute: HINSTANCE ShellExecute(HWND hwnd, LPCTSTR lpOperation, LPCTSTR lpFile, LPCTSTR lpParameters, LPCTSTR lpDirectory, INT nShowCmd ); It's last parameter may help you in your cause.

      Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

      1 Reply Last reply
      0
      • K koumodaki

        I have a program which needs to disable/enable IIS Admin. I am doing the following int val = system("net stop iisadmin"); But this function pops-up the dos window and asks the user for confirmation. I do not want this window to appear [Basically the user of my program need not be aware that the IIS is being disabled and hence need not respond to the dos window] Is there some way to stop the dos window poping up and asking for confirmation? Is there any other command that can be used? Is there a better way of doing this operation? Can I obtain the instance of IIS by using COM api and disable it?

        J Offline
        J Offline
        James R Twine
        wrote on last edited by
        #3

        You may be able to get around the confirmation by redirecting a text file containing a Y, or yes followed by a CR, but it would likely be better for you to just use the SCM/Service API directly to start/stop the service.    Lookup the StartService(...) Win32 function for more details.    Peace!

        -=- James
        Please rate this message - let me know if I helped or not! * * * If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
        Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
        See DeleteFXPFiles

        1 Reply Last reply
        0
        • K koumodaki

          I have a program which needs to disable/enable IIS Admin. I am doing the following int val = system("net stop iisadmin"); But this function pops-up the dos window and asks the user for confirmation. I do not want this window to appear [Basically the user of my program need not be aware that the IIS is being disabled and hence need not respond to the dos window] Is there some way to stop the dos window poping up and asking for confirmation? Is there any other command that can be used? Is there a better way of doing this operation? Can I obtain the instance of IIS by using COM api and disable it?

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          koumodaki wrote:

          Is there some way to stop the dos window poping up and asking for confirmation?

          Yes.

          echo y.|net stop iisadmin

          But you are better off using James' suggestion.


          "A good athlete is the result of a good and worthy opponent." - David Crow

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups