Launch a batch file in cmd via a windows shortcut - Microsoft Windows

This is a discussion on Launch a batch file in cmd via a windows shortcut - Microsoft Windows ; Hi, I have a shortcut which points to a batch file. The problem is that the output of the batch is printed to a cmd window which closes as soon as the batch is completed - when run via the ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Launch a batch file in cmd via a windows shortcut

  1. Launch a batch file in cmd via a windows shortcut

    Hi,

    I have a shortcut which points to a batch file. The problem is that
    the output of the batch is printed to a cmd window which closes as
    soon as the batch is completed - when run via the shortcut. Therefore
    I cant see its output. Is there a way of opening cmd via the shortcut
    and have it then run the batch, so that the cmd is still open after
    the batch has completed? I don't want a "hit any key to continue"
    option because I use the batch as a post build stage of a program I've
    writen.

    Thanks for your help,

    Barry.


  2. Re: Launch a batch file in cmd via a windows shortcut

    Two suggestions:

    1) Add a PAUSE statement at the end of the actual .BAT file.

    or

    2) Redirect the output of the shortcut for the .BAT file; that is, in the
    In the Shortcut Properties, Shortcut tab, append to the "Target:"
    redirection to a spacific file. For example., append a string like:
    > c:\windows\temp\batout.txt


    Then after running that shortcut, to view the .bat output at a
    command prompt issue the command:

    notepad c:\windows\temp\batout.txt

    Skip

    On 7 Mar 2007 01:27:05 -0800, bg_ie@yahoo.com wrote:

    -|Hi,
    -|
    -|I have a shortcut which points to a batch file. The problem is that
    -|the output of the batch is printed to a cmd window which closes as
    -|soon as the batch is completed - when run via the shortcut. Therefore
    -|I cant see its output. Is there a way of opening cmd via the shortcut
    -|and have it then run the batch, so that the cmd is still open after
    -|the batch has completed? I don't want a "hit any key to continue"
    -|option because I use the batch as a post build stage of a program I've
    -|writen.
    -|
    -|Thanks for your help,
    -|
    -|Barry.


  3. Re: Launch a batch file in cmd via a windows shortcut


    Change the target to CMD.EXE /K [batchfile]

    "Herman D. Knoble" wrote:
    >
    > Two suggestions:
    >
    > 1) Add a PAUSE statement at the end of the actual .BAT file.
    >
    > or
    >
    > 2) Redirect the output of the shortcut for the .BAT file; that is, in the
    > In the Shortcut Properties, Shortcut tab, append to the "Target:"
    > redirection to a spacific file. For example., append a string like:
    > > c:\windows\temp\batout.txt

    >
    > Then after running that shortcut, to view the .bat output at a
    > command prompt issue the command:
    >
    > notepad c:\windows\temp\batout.txt
    >
    > Skip
    >
    > On 7 Mar 2007 01:27:05 -0800, bg_ie@yahoo.com wrote:
    >
    > -|Hi,
    > -|
    > -|I have a shortcut which points to a batch file. The problem is that
    > -|the output of the batch is printed to a cmd window which closes as
    > -|soon as the batch is completed - when run via the shortcut. Therefore
    > -|I cant see its output. Is there a way of opening cmd via the shortcut
    > -|and have it then run the batch, so that the cmd is still open after
    > -|the batch has completed? I don't want a "hit any key to continue"
    > -|option because I use the batch as a post build stage of a program I've
    > -|writen.
    > -|
    > -|Thanks for your help,
    > -|
    > -|Barry.


    --
    Mike Walsh
    West Palm Beach, Florida, U.S.A.

+ Reply to Thread