Loading ...
Sorry, an error occurred while loading the content.

DOS Output

Expand Messages
  • djust@bigfoot.com
    Good evening, everyone! I d like to use NTP to prepare text files of the help screens of some DOS commands, say netstat /? , and put them in c:my documents .
    Message 1 of 6 , Apr 30, 2001
    • 0 Attachment
      Good evening, everyone!

      I'd like to use NTP to prepare text files of the help screens of some
      DOS commands, say "netstat /?", and put them in "c:my documents".
      Could someone please write me an example of how to do this?

      Thanks.
      David.
    • Alan C.
      Hi David, ... capturing help screens, I wonder if it is supported via the clip lingo. Maybe there is no example of how to do what you requested. However, I
      Message 2 of 6 , Apr 30, 2001
      • 0 Attachment
        Hi David,

        >I'd like to use NTP to prepare text files of the help screens of some
        >DOS commands, say "netstat /?", and put them in "c:my documents".
        >Could someone please write me an example of how to do this?

        capturing help screens, I wonder if it is supported via the clip
        lingo. Maybe there is no example of how to do what you requested.

        However, I did achieve a capture via my experimentations as explained in
        the following. (experimentations are fun and revealing).

        H="DosLog"
        ;pastes either into an active pasteboard doc or if no currently
        ;active pasteboard exists, then a new doc is used for pasteboard
        ;Larry Thomas <larryt@...>
        ;08/19/2000, 04:26:54 PM
        ;^!ChDir c:\
        ^!SetWizardTitle "Dos to Document"
        ^!Deletefile ^$GetAppPath$dc.bat
        ^!TextToFile "^$GetAppPath$dc.bat" ^?{(T=M)Enter Dos command=}
        ^!IfFalse ^$GetPasteBoardIndex$ Next Else Skip_2
        ^!Toolbar New Document
        ^!Toolbar Paste Board
        ^!SetClipboard ^$GetOutput("^$GetAppPath$dc.bat")$
        ^!IfTrue ^$IsPasteBoard$ Next Else Error
        ^!Paste
        ;^!Goto end
        :Error
        ^!IfFileExist "^$GetAppPath$StdError.err" Next Else Exit
        ^!Set %Output%============================^%nl%Standard Error
        ^!Append %Output%=^%nl%===========================^%nl%^%nl%
        ^!Append %Output%=^$GetFileText(^$GetStdErrorName$)$
        ^!IfTrue ^$IsPasteBoard$ Next Else Exit
        ^!SetClipboard ^%Output%
        ^!Paste
        ;-------<end of clip<<

        The above clip creates a small batch file (dc.bat) that's saved in Ntab's
        app directory. Note that the above uses "GetOutput" (getdosoutput won't
        work, I tried it). And, given no error, the clip is supposed to end with
        the captured result from the command. ( the goto end line exists just in
        case of a previously existing stderr.err file) (but I have the goto end
        line remarked out due to what happens as follows.

        Well, on Win NT OS, for me, the above clip it put command results into the
        error file then captured the outputted results from the error
        file. Command: netstat /?

        So, at least I had a captured help screen. And the clip ran smoothly for me.

        Alan.
      • Grant
        ... For non network commands you can use help ^!set %FileName%=^$GetTempFile$ ^!TextToFile ^%FileName% ^$getOutput( help dir )$ ^!wait ^!open ^%FileName% for
        Message 3 of 6 , Apr 30, 2001
        • 0 Attachment
          > I'd like to use NTP to prepare text files of the help screens of some
          > DOS commands, say "netstat /?", and put them in "c:my documents".
          > Could someone please write me an example of how to do this?

          For non network commands you can use help

          ^!set %FileName%=^$GetTempFile$
          ^!TextToFile "^%FileName%" ^$getOutput("help dir")$
          ^!wait
          ^!open ^%FileName%

          for a complete list of commands

          ^!set %FileName%=^$GetTempFile$
          ^!TextToFile "^%FileName%" ^$getOutput("help")$
          ^!wait
          ^!open ^%FileName%

          How ever The above does not work for the networK commands

          "Help Provides online information about Windows 2000 commands (non-network).
          "

          the net comands syntax is a bit different
          net help [cmd]

          ^!set %FileName%=^$GetTempFile$
          ^!TextToFile "^%FileName%" ^$getOutput("net help statistics")$
          ^!wait
          ^!open ^%FileName%

          To run cmd

          ^!set %FileName%=^$GetTempFile$
          ^!TextToFile "^%FileName%" ^$getOutput("net statistics")$
          ^!wait
          ^!open ^%FileName%

          However I could not get The netstat command to display help
          Although it did at the command prompt

          The following netstat output clearly works though

          ^!set %FileName%=^$GetTempFile$
          ^!TextToFile "^%FileName%" ^$getOutput(netstat -p tcp)$
          ^!wait
          ^!open ^%FileName%

          So What's going on? Ok read Alan c post and try capturing std err

          ^!set %FileName%=^$GetTempFile$
          ^!TextToFile "^%FileName%" ^$GetOutput(netstat /?)$
          ^!wait
          ^!open ^%FileName%
          ^!Open ^$GetStdErrorName$

          Ok StdError got it but why is this happening?
          Are we seeing the same inconsistency we saw in the perl discussion a while
          back?
        • Tom
          you ll need to remove the double quotes around the ^$getOutput argument in order for the suggested clips to work. e.g.: ^!TextToFile ^%FileName%
          Message 4 of 6 , Jul 1, 2001
          • 0 Attachment
            you'll need to remove the double quotes around the ^$getOutput
            argument in order for the suggested clips to work. e.g.:

            ^!TextToFile "^%FileName%" ^$getOutput(help dir)$
            ^!TextToFile "^%FileName%" ^$getOutput(help)$

            cheers,
            tom

            --- In ntb-clips@y..., "Grant" <emerge@p...> wrote:
            >
            > > I'd like to use NTP to prepare text files of the help screens of
            some
            > > DOS commands, say "netstat /?", and put them in "c:my documents".
            > > Could someone please write me an example of how to do this?
            >
            > For non network commands you can use help
            >
            > ^!set %FileName%=^$GetTempFile$
            > ^!TextToFile "^%FileName%" ^$getOutput("help dir")$
            > ^!wait
            > ^!open ^%FileName%
            >
            > for a complete list of commands
            >
            > ^!set %FileName%=^$GetTempFile$
            > ^!TextToFile "^%FileName%" ^$getOutput("help")$
            > ^!wait
            > ^!open ^%FileName%

            ~~ snip ~~
          • Tom
            oops! CORRECTION: you ll need to use ^$GetDosOutput instead of ^$GetOutput in order for the suggested clips to work. e.g.: ^!TextToFile ^%FileName%
            Message 5 of 6 , Jul 1, 2001
            • 0 Attachment
              oops! CORRECTION: you'll need to use ^$GetDosOutput instead of
              ^$GetOutput in order for the suggested clips to work. e.g.:

              ^!TextToFile "^%FileName%" ^$GetDosOutput(help dir)$
              ^!TextToFile "^%FileName%" ^$GetDosOutput(help)$

              quotes are optional. sorry about that, i even confused myself :|.

              cheers,
              tom

              --- In ntb-clips@y..., "Tom" <tom_xyz@y...> wrote:
              > you'll need to remove the double quotes around the ^$getOutput
              > argument in order for the suggested clips to work. e.g.:
              >
              > ^!TextToFile "^%FileName%" ^$getOutput(help dir)$
              > ^!TextToFile "^%FileName%" ^$getOutput(help)$
              >
              > cheers,
              > tom

              ~~ snip ~~
            • Grant
              ... Hi Tom How did this come out of the ether. If my memory serves me right I think I originally answered a question in relation to win2k network commands .
              Message 6 of 6 , Jul 1, 2001
              • 0 Attachment
                > oops! CORRECTION: you'll need to use ^$GetDosOutput instead of
                > ^$GetOutput in order for the suggested clips to work. e.g.:
                >
                > ^!TextToFile "^%FileName%" ^$GetDosOutput(help dir)$
                > ^!TextToFile "^%FileName%" ^$GetDosOutput(help)$
                >
                > quotes are optional. sorry about that, i even confused myself :|.

                Hi Tom
                How did this come out of the ether.

                If my memory serves me right I think I originally answered a question in
                relation to win2k 'network' commands .
                Using ^$getOutput()$ works in a nt4 or win2k environment , you might have
                to resort to using ^$getDosOutput()$ with
                as inferior ;) operating systems , I don't know?

                There is however a problem with ^$GetOutput()$ in certain circumstances
                where output goes to stdERR instead of stdOut
                which I hope Eric can resolve..

                Captures stdOut ok

                ^!set %FileName%=^$GetTempFile$
                ^!TextToFile "^%FileName%" ^$getOutput("netstat -p tcp")$
                ^!wait
                ^!open ^%FileName%

                Does not captures stdOut but goes to StdError instead.

                ^!set %FileName%=^$GetTempFile$
                ^!TextToFile "^%FileName%" ^$GetOutput(netstat /?)$
                ^!wait
                ^!open ^%FileName%
                ^!Open ^$GetStdErrorName$

                As a wild guess I would say it is something to do with "?" in the command
                prompt confusing the notetab parser
              Your message has been successfully submitted and would be delivered to recipients shortly.