Batch file question

Discussion in 'NZ Computing' started by mark, Sep 7, 2006.

  1. mark

    mark Guest

    I'm wanting to open a Windows application that resides on another machine
    across the network, and if that machine is not turned on I don't want the
    machine to "hang" while it figures that out.

    Using "\\<machine name>\<path>\<executable name>" inside a batch file
    mostly does what I need, but leaves an ugle DOS window open too.

    It's been ages since I've needed to use DOS batch files - is there a better
    way?

    Cheers,
    Mark
    mark, Sep 7, 2006
    #1
    1. Advertising

  2. mark

    GraB Guest

    On 8 Sep 2006 00:31:13 +1200, mark <> wrote:

    >
    >
    >I'm wanting to open a Windows application that resides on another machine
    >across the network, and if that machine is not turned on I don't want the
    >machine to "hang" while it figures that out.
    >
    >Using "\\<machine name>\<path>\<executable name>" inside a batch file
    >mostly does what I need, but leaves an ugle DOS window open too.
    >
    >It's been ages since I've needed to use DOS batch files - is there a better
    >way?
    >
    >Cheers,
    >Mark


    Perhaps some kind of Windows macro programme?
    http://tinyurl.com/qsdss
    GraB, Sep 7, 2006
    #2
    1. Advertising

  3. mark wrote:
    > I'm wanting to open a Windows application that resides on another machine
    > across the network, and if that machine is not turned on I don't want the
    > machine to "hang" while it figures that out.


    How about...

    ping -n 1 -w 100 %MACHINEIP%
    if errorlevel 1 goto eof
    REM Whatever you need to do if the machine is running
    :eof

    The Other Guy
    The Other Guy, Sep 7, 2006
    #3
  4. mark

    Dave Taylor Guest

    The Other Guy <> wrote in news:edpo96$shu$:

    > How about...
    >
    > ping -n 1 -w 100 %MACHINEIP%
    > if errorlevel 1 goto eof
    > REM Whatever you need to do if the machine is running
    >:eof
    >


    And an exit to close the window.

    --
    Ciao, Dave
    Dave Taylor, Sep 8, 2006
    #4
  5. In message <Xns9838C62B41433daveytaynospamplshot@203.97.37.6>, Dave Taylor
    wrote:

    > The Other Guy <> wrote in news:edpo96$shu$:
    >
    >> How about...
    >>
    >> ping -n 1 -w 100 %MACHINEIP%
    >> if errorlevel 1 goto eof
    >> REM Whatever you need to do if the machine is running
    >>:eof
    >>

    >
    > And an exit to close the window.


    Can't you just run the script in the background?
    Lawrence D'Oliveiro, Sep 8, 2006
    #5
  6. mark

    mark Guest

    The Other Guy <> wrote in
    news:edpo96$shu$:

    > mark wrote:
    >> I'm wanting to open a Windows application that resides on another
    >> machine across the network, and if that machine is not turned on I
    >> don't want the machine to "hang" while it figures that out.

    >
    > How about...
    >
    > ping -n 1 -w 100 %MACHINEIP%
    > if errorlevel 1 goto eof
    > REM Whatever you need to do if the machine is running
    >:eof
    >
    > The Other Guy




    Cool, but not quite what I need :)

    From my original post:

    "Using "\\<machine name>\<path>\<executable name>" inside a batch file
    mostly does what I need, but leaves an ugle DOS window open too."


    The key bit I'm looking for it a way to close the ugly DOS window as soon
    as it launches the Windows app :)

    Cheers,
    Mark
    mark, Sep 8, 2006
    #6
  7. mark

    mark Guest

    Dave Taylor <> wrote in
    news:Xns9838C62B41433daveytaynospamplshot@203.97.37.6:

    > The Other Guy <> wrote in news:edpo96$shu$:
    >
    >> How about...
    >>
    >> ping -n 1 -w 100 %MACHINEIP%
    >> if errorlevel 1 goto eof
    >> REM Whatever you need to do if the machine is running
    >>:eof
    >>

    >
    > And an exit to close the window.



    Unfortunately an exit after the command doesn't close the Window (I know,
    it should, but I've already tried that ;)).

    Cheers,
    Mark
    mark, Sep 8, 2006
    #7
  8. mark

    mark Guest

    Lawrence D'Oliveiro <_zealand> wrote in
    news:edr892$jfk$:

    > Subject: Re: Batch file question
    > From: Lawrence D'Oliveiro <_zealand>
    > Newsgroups: nz.comp
    >
    > In message <Xns9838C62B41433daveytaynospamplshot@203.97.37.6>, Dave
    > Taylor wrote:
    >
    >> The Other Guy <> wrote in
    >> news:edpo96$shu$:
    >>
    >>> How about...
    >>>
    >>> ping -n 1 -w 100 %MACHINEIP%
    >>> if errorlevel 1 goto eof
    >>> REM Whatever you need to do if the machine is running
    >>>:eof
    >>>

    >>
    >> And an exit to close the window.

    >
    > Can't you just run the script in the background?
    >
    >




    If runs in the background, the key point from my original post that people
    have overlooked is that my batch file does what I want apart from CLOSING
    ITSELF once it has launched the WIndows app, and that is the thing I have
    forgotten how to do. Exit does not do the trick.

    Cheers,
    Mark
    mark, Sep 8, 2006
    #8
  9. In message <Xns9838DF8CB52DFsometimes2003@60.234.1.32>, mark wrote:

    > Lawrence D'Oliveiro <_zealand> wrote in
    > news:edr892$jfk$:
    >
    >> Subject: Re: Batch file question
    >> From: Lawrence D'Oliveiro <_zealand>
    >> Newsgroups: nz.comp
    >>
    >> In message <Xns9838C62B41433daveytaynospamplshot@203.97.37.6>, Dave
    >> Taylor wrote:
    >>
    >>> The Other Guy <> wrote in
    >>> news:edpo96$shu$:
    >>>
    >>>> How about...
    >>>>
    >>>> ping -n 1 -w 100 %MACHINEIP%
    >>>> if errorlevel 1 goto eof
    >>>> REM Whatever you need to do if the machine is running
    >>>>:eof
    >>>>
    >>>
    >>> And an exit to close the window.

    >>
    >> Can't you just run the script in the background?
    >>

    >
    > If runs in the background, the key point from my original post that people
    > have overlooked is that my batch file does what I want apart from CLOSING
    > ITSELF once it has launched the WIndows app


    Why do you have to open a window in the first place? That's what I meant
    by "running in the background"--no UI, no window.
    Lawrence D'Oliveiro, Sep 8, 2006
    #9
  10. mark

    mark Guest

    Lawrence D'Oliveiro <_zealand> wrote in
    news:edries$6f2$:

    > Why do you have to open a window in the first place? That's what I
    > meant by "running in the background"--no UI, no window.



    I can use a shortcut to the batch file and set it to run minimized if that
    is what you are thinking of - that would still leave an extra item sitting
    on the taskbar that I'd not want there though, with the same name as the
    actual program in this case, which would add to the confusion :)

    I'm hoping someone in the news group remembers how to run a Windows app
    from within a batch file, and then have the batch file quit - without
    having to have it wait for the Windows app to quit before terminating.
    mark, Sep 8, 2006
    #10
  11. mark wrote:
    > "Using "\\<machine name>\<path>\<executable name>" inside a batch file
    > mostly does what I need, but leaves an ugle DOS window open too."
    >
    >
    > The key bit I'm looking for it a way to close the ugly DOS window as soon
    > as it launches the Windows app :)


    If you run another uninteresting batch file, will it close by itself?

    This behaviour varies, depending on your Windows version. I think in NT
    this is controlled by a registry setting.

    If a generic batch file closes where your own doesn't, try passing the
    close command through to a new instance of cmd.exe, or using the /C option.

    The Other Guy
    The Other Guy, Sep 8, 2006
    #11
  12. mark

    Don Hills Guest

    In article <Xns9838F1B822E78sometimes2003@60.234.1.32>,
    mark <> wrote:
    >
    >I'm hoping someone in the news group remembers how to run a Windows app
    >from within a batch file, and then have the batch file quit - without
    >having to have it wait for the Windows app to quit before terminating.


    START WINDOWS_APP.EXE

    There are various options to modify the behaviour of the command.

    --
    Don Hills (dmhills at attglobaldotnet) Wellington, New Zealand
    "New interface closely resembles Presentation Manager,
    preparing you for the wonders of OS/2!"
    -- Advertisement on the box for Microsoft Windows 2.11 for 286
    Don Hills, Sep 8, 2006
    #12
  13. mark

    jasen Guest

    On 2006-09-08, mark <> wrote:
    >
    > If runs in the background, the key point from my original post that people
    > have overlooked is that my batch file does what I want apart from CLOSING
    > ITSELF once it has launched the WIndows app, and that is the thing I have
    > forgotten how to do. Exit does not do the trick.


    START //wherever/dir/application
    exit

    you may need to create a shortcut with close-on-exit checked and use that to
    run the batch too.

    Bye.
    Jasen
    jasen, Sep 8, 2006
    #13
  14. In message <Xns9838F1B822E78sometimes2003@60.234.1.32>, mark wrote:

    > Lawrence D'Oliveiro <_zealand> wrote in
    > news:edries$6f2$:
    >
    >> Why do you have to open a window in the first place? That's what I
    >> meant by "running in the background"--no UI, no window.

    >
    > I can use a shortcut to the batch file and set it to run minimized if that
    > is what you are thinking of - that would still leave an extra item sitting
    > on the taskbar that I'd not want there though, with the same name as the
    > actual program in this case, which would add to the confusion :)


    I thought Windows was a multitasking OS. Is there no way to start a process
    completely detached from any GUI? For instance in Linux, from an
    interactive shell I can type

    setsid command-i-want-to-run </dev/null >/dev/null 2>&1

    where the /dev/null redirections ensure that the command has no connection
    to the current terminal window at all, and the setsid causes the background
    process to have its own session group, so it's not terminated when I log
    out of the interactive shell.

    For non-interactive invocation, there are even more ways, like the "at"
    command, and crontab. E.g. I wake myself up in the morning like this:

    at 07:00 <<<"~/hack/random_play ~/Documents/Music/Converted/"
    Lawrence D'Oliveiro, Sep 8, 2006
    #14
  15. mark

    mark Guest

    (Don Hills) wrote in
    news::

    > In article <Xns9838F1B822E78sometimes2003@60.234.1.32>,
    > mark <> wrote:
    >>
    >>I'm hoping someone in the news group remembers how to run a Windows app
    >>from within a batch file, and then have the batch file quit - without
    >>having to have it wait for the Windows app to quit before terminating.

    >
    > START WINDOWS_APP.EXE
    >
    > There are various options to modify the behaviour of the command.



    Already tried start - with the executable path being a UNC it just stops
    with shell window open.. It doesn't actually launch the executable.
    mark, Sep 9, 2006
    #15
  16. mark

    mark Guest

    jasen <> wrote in news:edslv5$c2g$:

    > On 2006-09-08, mark <> wrote:
    >>
    >> If runs in the background, the key point from my original post that
    >> people have overlooked is that my batch file does what I want apart
    >> from CLOSING ITSELF once it has launched the WIndows app, and that is
    >> the thing I have forgotten how to do. Exit does not do the trick.

    >
    > START //wherever/dir/application
    > exit



    I've already tried exactly the above, unfortunately when passed a UNC path
    to the executable it just stops - no error messages and no application
    launch.


    > you may need to create a shortcut with close-on-exit checked and use
    > that to run the batch too.
    >
    > Bye.
    > Jasen



    There is no close-on-exit option for a shortcut pointing at a batch file
    under Windows XP Pro, but in this case, even it there was it wouldn't work
    because it never actually reaches the end of the batch file until the
    application launched by the batch file is exited.


    Thanks for trying anyway.
    mark, Sep 9, 2006
    #16
  17. mark

    El Penguino Guest

    On Sat, 09 Sep 2006 09:32:50 +1200, Lawrence D'Oliveiro
    <_zealand> wrote:

    >In message <Xns9838F1B822E78sometimes2003@60.234.1.32>, mark wrote:
    >
    >> Lawrence D'Oliveiro <_zealand> wrote in
    >> news:edries$6f2$:
    >>
    >>> Why do you have to open a window in the first place? That's what I
    >>> meant by "running in the background"--no UI, no window.

    >>
    >> I can use a shortcut to the batch file and set it to run minimized if that
    >> is what you are thinking of - that would still leave an extra item sitting
    >> on the taskbar that I'd not want there though, with the same name as the
    >> actual program in this case, which would add to the confusion :)

    >
    >I thought Windows was a multitasking OS. Is there no way to start a process
    >completely detached from any GUI?


    I'm no expert but I think what you are describing can be done with a
    service.
    El Penguino, Sep 9, 2006
    #17
  18. mark

    Ray Greene Guest

    On 8 Sep 2006 00:31:13 +1200, mark <> wrote:

    >I'm wanting to open a Windows application that resides on another machine
    >across the network, and if that machine is not turned on I don't want the
    >machine to "hang" while it figures that out.
    >
    >Using "\\<machine name>\<path>\<executable name>" inside a batch file
    >mostly does what I need, but leaves an ugle DOS window open too.
    >
    >It's been ages since I've needed to use DOS batch files - is there a better
    >way?


    Does it have to be a batch file? VBScript will do the job.


    Dim fso, wsh, sFile
    sFile = "\\<machine name>\<path>\<executable name>"
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set wsh = CreateObject("WScript.Shell")
    If fso.FileExists(sFile) Then wsh.Run sFile, 1, False


    --
    Ray Greene
    Ray Greene, Sep 9, 2006
    #18
  19. In message <>, El Penguino wrote:

    > On Sat, 09 Sep 2006 09:32:50 +1200, Lawrence D'Oliveiro
    > <_zealand> wrote:
    >
    >>In message <Xns9838F1B822E78sometimes2003@60.234.1.32>, mark wrote:
    >>
    >>> Lawrence D'Oliveiro <_zealand> wrote in
    >>> news:edries$6f2$:
    >>>
    >>>> Why do you have to open a window in the first place? That's what I
    >>>> meant by "running in the background"--no UI, no window.
    >>>
    >>> I can use a shortcut to the batch file and set it to run minimized if
    >>> that is what you are thinking of - that would still leave an extra item
    >>> sitting on the taskbar that I'd not want there though, with the same
    >>> name as the actual program in this case, which would add to the
    >>> confusion :)

    >>
    >>I thought Windows was a multitasking OS. Is there no way to start a
    >>process completely detached from any GUI?

    >
    > I'm no expert but I think what you are describing can be done with a
    > service.


    How is a "service" different from a "process"?
    Lawrence D'Oliveiro, Sep 9, 2006
    #19
  20. mark

    Bryce Utting Guest

    Lawrence D'Oliveiro <_zealand> wrote:
    >>>I thought Windows was a multitasking OS. Is there no way to start a
    >>>process completely detached from any GUI?

    >>
    >> I'm no expert but I think what you are describing can be done with a
    >> service.

    >
    > How is a "service" different from a "process"?


    .... you need a root password to start a service?


    butting

    --
    I am very new to programming drivers so if I sound un-knowledgeable
    then it's because I am.
    -- first4internet's Ceri Coburn on writing Sony's DRM rootkit
    http://homepages.ihug.co.nz/~butting
    Bryce Utting, Sep 9, 2006
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gerard Bok

    Re: Ability to send an email message from within a batch file

    Gerard Bok, Sep 8, 2004, in forum: Microsoft Certification
    Replies:
    0
    Views:
    581
    Gerard Bok
    Sep 8, 2004
  2. BatchFile Bob

    Batch File Delete?

    BatchFile Bob, Jun 18, 2004, in forum: MCSE
    Replies:
    4
    Views:
    6,617
    adamavich
    Aug 1, 2006
  3. Tom

    Batch File - Renaming File with DATE

    Tom, Mar 3, 2007, in forum: Computer Support
    Replies:
    11
    Views:
    7,841
  4. gimp

    batch file question

    gimp, May 20, 2004, in forum: NZ Computing
    Replies:
    6
    Views:
    301
  5. lbbss

    Batch file to backup one Doc file?

    lbbss, Mar 23, 2010, in forum: Computer Support
    Replies:
    10
    Views:
    533
    sandy58
    Mar 23, 2010
Loading...

Share This Page