Note that there are some explanatory texts on larger screens.

plurals
  1. POBatch won't show command result: closes window too quickly too read
    primarykey
    data
    text
    <p>First of all, sorry if my description of the problem is off. The problem I'm having is that when I run a command within my batch file, it opens another console window, displays the result for a fraction of a second, then closes again. I would like to have the result of the command (devcon status) displayed in that window with something like a "pause" option.</p> <p>Here's the code:</p> <pre><code>@ECHO off cls :start ECHO. ECHO What would you like to do? ECHO 1. Disable Bluetooth ECHO 2. Enable Bluetooth ECHO 3. Check status ECHO 4. Quit ECHO. set /p choice=Type the first word of the option you want. ECHO. if %choice%==Disable ( goto :DBt ) else if %choice%==Enable ( goto :EBt ) else if %choice%==Check ( goto :CS ) else if %choice%==Quit ( goto :end ) else ( echo Invalid choice. pause goto start ) :DBt devcon disable *REV_7869 goto end :Ebt devcon enable *REV_7869 goto end :CS devcon status *REV_7869 goto end :end exit </code></pre> <p>When I type in "Check," it will open another console window, run the devcon status command correctly, but immediately close the window when it has the result.</p> <p>When I run "devcon status [my adapter id]" through the command prompt, it will return "1 device found.... driver running." When I do it from the batch file, however, it opens a new window which closes instantly after the command has run, not allowing me to see the result of it.</p> <p>Adding "pause" after "devcon status *REV" didn't help the problem. It just put "Press any key to continue" in the original command window after the other one had run the command and closed.</p> <p>So my question is how can I keep that second window open after the command has run?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload