Results 1 to 8 of 8
  1. #1
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    cmd Prompt opens

    Hi,

    I've got a .bat file that is going to be used to monitor time spans that various programs are open. This works fine. My problem is that when the file is activated, the cmd prompt opens and remains open in the background. I'd like to prevent this from happening. Is there code to either keep the cmd promt hidden or to close it after the .bat file is run.

    Thanks,
    Leesha

  2. #2
    3 Star Lounger
    Join Date
    Aug 2004
    Location
    Saco, Maine, USA
    Posts
    293
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: cmd Prompt opens

    Hi,
    By using the Start command, there's an option to run your file minimized. As to closing it when done, add the exit command to the last line in your bat file.

  3. #3
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: cmd Prompt opens

    Hi,

    Thanks for responding. ? What the smart command is? Also, is it available in Windows 2000.

    Thanks,
    Leesha

  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: cmd Prompt opens

    Start is a command that you can use in a Command window. You can get the following syntax help by typing START /?

    StuartR
    <code>
    Starts a separate window to run a specified program or command.

    START <!t>["title"]<!/t> <!t>[/Dpath]<!/t> <!t>[/I]<!/t> <!t>[/MIN]<!/t> <!t>[/MAX]<!/t> <!t>[/SEPARATE | /SHARED]<!/t>
    <!t>[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]<!/t>
    <!t>[/WAIT]<!/t> <!t>[/B]<!/t> <!t>[command/program]<!/t>
    <!t>[parameters]<!/t>

    <table border=0><td>"title"</td><td>Title to display in window title bar.</td><td>path</td><td>Starting directory</td><td>B</td><td>Start application without creating a new window. The application has ^C handling ignored. Unless the application enables ^C processing, ^Break is the only way to interrupt the application</td><td>I</td><td>The new environment will be the original environment passed to the cmd.exe and not the current environment.</td><td>MIN</td><td>Start window minimized</td><td>MAX</td><td>Start window maximized</td><td>SEPARATE </td><td>Start 16-bit Windows program in separate memory space</td><td>SHARED</td><td>Start 16-bit Windows program in shared memory space</td><td>LOW</td><td>Start application in the IDLE priority class</td><td>NORMAL</td><td>Start application in the NORMAL priority class</td><td>HIGH</td><td>Start application in the HIGH priority class</td><td>REALTIME</td><td>Start application in the REALTIME priority class</td><td>ABOVENORMAL</td><td>Start application in the ABOVENORMAL priority class</td><td>BELOWNORMAL</td><td>Start application in the BELOWNORMAL priority class</td><td>WAIT</td><td>Start application and wait for it to terminate</td></table></code>
    Rest of output cut off here by StuartR to avoid the post being too long

  5. #5
    3 Star Lounger
    Join Date
    Aug 2004
    Location
    Saco, Maine, USA
    Posts
    293
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: cmd Prompt opens

    You beat me to it!

  6. #6
    Silver Lounger
    Join Date
    Apr 2001
    Location
    New York, New York, USA
    Posts
    2,328
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: cmd Prompt opens

    One of solutions is to use additional bat file.
    For example, if your original bat file is mybat.bat, create and run additional bat file with the command

    cmd /c mybat.bat

    In this command /c switch will carry your bat file and then terminate command prompt window.
    Remainder of the command can recognize long filename and path, for example:

    cmd /c "D:Additional filesBat filesMy bat file.bat"

  7. #7
    Lounger
    Join Date
    Jan 2001
    Location
    Ancaster, Ontario
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: cmd Prompt opens

    Or use the shortcut properties to run the file. In properties select close on exit.

  8. #8
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: cmd Prompt opens

    Thanks everyone! I'll give the suggestions a shot. I haven't been on in a few days to to family stuff and was tickled at all the options available and new areas of learning!

    Thanks again,
    Leesha

Posting Permissions

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