Command line parameters?

Discussion in 'Scripting' started by Linn Kubler, Jan 22, 2009.

  1. Linn Kubler

    Linn Kubler Guest

    Hi,

    I have a boot floppy for booting my computer to connect to the network so I
    can run Ghost and image my machine. I wrote a little batch file called
    logoff.bat for loging off the network when I'm finished.

    Logoff.bat contains:
    @net stop

    When it runs it prompts me for three different responses:
    Stopping the NETBEUI service also stops these services:
    REQUESTER
    Do you want to continue this operation? (Y/N) [Y]:
    You are currently logged on as Me.
    Do you want to log off? (Y/N) [N]:
    Continuing will cancel these connections:
    G: \\myserver\myshare
    Do you want to continue this operation? (Y/N) [N]:

    I answer Y to all three of these and it logs me out.

    Question is, is there a way to pass these key strokes through so I don't
    have to hit them? I know, just being lazy. But I would like to do this,
    will save me some time.

    I tried:
    a:\logoff Y Y Y
    a:\logoff < logoff.txt

    Where logoff.txt contains:
    Y
    Y
    Y

    Neither worked. Any other suggestions?

    Thanks in advance,
    Linn
     
    Linn Kubler, Jan 22, 2009
    #1
    1. Advertisements

  2. Linn Kubler

    Al Dunbar Guest

    the NET command does not seem to accept redirected input, but looks to the
    actual console. You could try running your batch file as a scheduled task to
    see if NET will assume what you want. Most likely, however, I'd expect it to
    just hang.

    Alternately, you could script the actions you want performed, and write your
    script to interact in whatever way makes sense.

    What is it that you want to have happen after the logoff? If you are going
    to reboot anyway, you could simply modify your .bat file to execute one of
    the availalble "reboot" utilities.

    /Al
     
    Al Dunbar, Jan 22, 2009
    #2
    1. Advertisements

  3. Linn Kubler

    Al Dunbar Guest

    the NET command does not seem to accept redirected input, but looks to the
    actual console. You could try running your batch file as a scheduled task to
    see if NET will assume what you want. Most likely, however, I'd expect it to
    just hang.

    Alternately, you could script the actions you want performed, and write your
    script to interact in whatever way makes sense.

    What is it that you want to have happen after the logoff? If you are going
    to reboot anyway, you could simply modify your .bat file to execute one of
    the availalble "reboot" utilities.

    /Al
     
    Al Dunbar, Jan 22, 2009
    #3
  4. Linn Kubler

    Linn Kubler Guest

    Yeah, that's what I suspected you'd say, that NET doesn't accept input like
    this. I always prefer to logout of a system once I have logged in, just
    seems the proper way to interact with systems. It's not that big of a deal
    and I don't actually use this more than a few times a year, just thought it
    would be nice to not to have to be bothered by it.

    Thanks and thanks for responding so quickly,
    Linn
     
    Linn Kubler, Jan 22, 2009
    #4
  5. What operating system do you have on your boot floppy? DOS 7?
     
    Pegasus \(MVP\), Jan 22, 2009
    #5
  6. Linn Kubler

    Al Dunbar Guest

    A few issues...

    - First is that I expect that most of the shutdown/reboot utilities
    effectively do an implicit logout.

    - Second is that if you have logged in with a boot disk in order to re-image
    your computer, you are not really logged in in the same way that you are
    when you logon to your domain.

    If you are manually logging out from this session, the new image is not yet
    activated. If you have booted from a floppy, the only sense in which you are
    "logged in" is that you have established connections with network resources
    such as file shares. From that point of view, I suspect you are the only
    entity involved that sees a difference between logging out and simply
    terminating share connections. I'm pretty sure it's all the same to the
    servers and your network. And the instance of the O/S installed on the
    workstation is a non-issue, as it has not been booted.

    Or perhaps your environment is radically different from mine.

    /Al
     
    Al Dunbar, Jan 22, 2009
    #6
  7. Linn Kubler

    Linn Kubler Guest

    It's PC DOS Version 7.1 Rev. 0
     
    Linn Kubler, Jan 23, 2009
    #7
  8. It's quite a few years since I played with my DOS network boot disks and
    they have fallen somewhat into disrepair. Since you use this facility
    rarely, it would probably take me more time to work out an answer than it
    takes you to respond to the chain of prompts over a couple of years . . . I
    therefore won't persist.
     
    Pegasus \(MVP\), Jan 23, 2009
    #8
  9. Linn Kubler

    Tom_Slycke Guest

    Try this
    - Create a text file with your responses... your logoff.txt file looks good,
    make sure there is a carriage return after that last "y"
    - instead of executing a:\logoff
    us
    type logoff.txt | logoff

    This will pipe the response file as input into the logoff program.

    Tom
     
    Tom_Slycke, Jan 25, 2009
    #9
  10. Linn Kubler

    Al Dunbar Guest

    he didn't just execute "A:\logoff", he redirected his reponse file into it
    using redirection
    If the executable were actually reading its input from stdin, redirection
    and piping would both work. Since it appears to not be reading from stdin,
    then neither will work.

    /Al
     
    Al Dunbar, Jan 25, 2009
    #10
  11. Linn Kubler

    Tom_Slycke Guest


    oopps... point taken
     
    Tom_Slycke, Jan 25, 2009
    #11
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.