DOS TYPE command from within VB

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Darin

    DOS TYPE command from within VB

    I need to open a cash drawer and the easiest way to do that is to:

    ECHO "||" > LPT1

    I have put:

    system.diagnost ics.process.sta rt (my echo command)

    but it fails with a File Not Found error.

    Any ideas???

    Darin

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Herfried K. Wagner [MVP]

    #2
    Re: DOS TYPE command from within VB

    "Darin" <darin_nospam@n ospamever> schrieb:[color=blue]
    > ECHO "||" > LPT1
    >
    > I have put:
    >
    > system.diagnost ics.process.sta rt (my echo command)
    >
    > but it fails with a File Not Found error.[/color]

    Echo is a feature of the windows command-line shell ("cmd.exe"). The sample
    below will show you how to control "cmd.exe" using a .NET application:

    RedirectConsole
    <URL:http://dotnet.mvps.org/dotnet/samples/misc/RedirectConsole .zip>

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

    Comment

    • Bob Hollness

      #3
      Re: DOS TYPE command from within VB

      Herfried K. Wagner [MVP] wrote:
      [color=blue]
      > "Darin" <darin_nospam@n ospamever> schrieb:[color=green]
      >> ECHO "||" > LPT1
      >>
      >> I have put:
      >>
      >> system.diagnost ics.process.sta rt (my echo command)
      >>
      >> but it fails with a File Not Found error.[/color]
      >
      > Echo is a feature of the windows command-line shell ("cmd.exe"). The
      > sample below will show you how to control "cmd.exe" using a .NET
      > application:
      >
      > RedirectConsole
      > <URL:http://dotnet.mvps.org/dotnet/samples/misc/RedirectConsole .zip>
      >[/color]
      why not just use SHELL?
      --

      I'll have a B please Bob.

      Comment

      • Darin

        #4
        Re: DOS TYPE command from within VB

        Shell worked fine.

        Darin

        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        • IT@ECommunity

          #5
          Re: DOS TYPE command from within VB

          I never had any luck using shell with Echo. The redirect Console app saved
          me from insanity. I could not get the echo to work via the shell with gpg
          commands.



          "Bob Hollness" <bob@blockbuste r.com> wrote in message
          news:%233eUmZ9A FHA.3140@TK2MSF TNGP15.phx.gbl. ..[color=blue]
          > Herfried K. Wagner [MVP] wrote:
          >[color=green]
          >> "Darin" <darin_nospam@n ospamever> schrieb:[color=darkred]
          >>> ECHO "||" > LPT1
          >>>
          >>> I have put:
          >>>
          >>> system.diagnost ics.process.sta rt (my echo command)
          >>>
          >>> but it fails with a File Not Found error.[/color]
          >>
          >> Echo is a feature of the windows command-line shell ("cmd.exe"). The
          >> sample below will show you how to control "cmd.exe" using a .NET
          >> application:
          >>
          >> RedirectConsole
          >> <URL:http://dotnet.mvps.org/dotnet/samples/misc/RedirectConsole .zip>
          >>[/color]
          > why not just use SHELL?
          > --
          >
          > I'll have a B please Bob.[/color]


          Comment

          • Herfried K. Wagner [MVP]

            #6
            Re: DOS TYPE command from within VB

            "Darin" <darin_nospam@n ospamever> schrieb:[color=blue]
            > Shell worked fine.[/color]

            Can you post the working code? 'Shell' does not have any advantage over
            'Process' in processing command-line shell commands.

            --
            M S Herfried K. Wagner
            M V P <URL:http://dotnet.mvps.org/>
            V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

            Comment

            • Darin

              #7
              Re: DOS TYPE command from within VB

              junk = "ECHO " & Qte(Chr(1) & Chr(1), True) & " > " & Trim(port)
              Shell(junk, AppWinStyle.Hid e)

              Qte is a routine that will put text in " ", so this is:

              ECHO "ctrl-A ctrl-A" > LPT1

              Darin

              *** Sent via Developersdex http://www.developersdex.com ***
              Don't just participate in USENET...get rewarded for it!

              Comment

              • Nikolay Petrov

                #8
                Re: DOS TYPE command from within VB

                you can use Process.StartIn fo:

                Sub Print()
                Dim p As Process = New Process
                With p.StartInfo
                .FileName = "cmd"
                .Arguments = "/c echo ""||"">LPT"
                .UseShellExecut e = False
                .CreateNoWindow = True
                End With
                p.Start()
                End Sub

                "Darin" <darin_nospam@n ospamever> wrote in message
                news:OqEbYv8AFH A.3576@TK2MSFTN GP11.phx.gbl...[color=blue]
                >I need to open a cash drawer and the easiest way to do that is to:
                >
                > ECHO "||" > LPT1
                >
                > I have put:
                >
                > system.diagnost ics.process.sta rt (my echo command)
                >
                > but it fails with a File Not Found error.
                >
                > Any ideas???
                >
                > Darin
                >
                > *** Sent via Developersdex http://www.developersdex.com ***
                > Don't just participate in USENET...get rewarded for it![/color]


                Comment

                • Nikolay Petrov

                  #9
                  Re: DOS TYPE command from within VB

                  you can use Process.StartIn fo:

                  Sub Print()
                  Dim p As Process = New Process
                  With p.StartInfo
                  .FileName = "cmd"
                  .Arguments = "/c echo ""||"">LPT"
                  .UseShellExecut e = False
                  .CreateNoWindow = True
                  End With
                  p.Start()
                  End Sub

                  "Darin" <darin_nospam@n ospamever> wrote in message
                  news:OqEbYv8AFH A.3576@TK2MSFTN GP11.phx.gbl...[color=blue]
                  >I need to open a cash drawer and the easiest way to do that is to:
                  >
                  > ECHO "||" > LPT1
                  >
                  > I have put:
                  >
                  > system.diagnost ics.process.sta rt (my echo command)
                  >
                  > but it fails with a File Not Found error.
                  >
                  > Any ideas???
                  >
                  > Darin
                  >
                  > *** Sent via Developersdex http://www.developersdex.com ***
                  > Don't just participate in USENET...get rewarded for it![/color]


                  Comment

                  • Darin

                    #10
                    Re: DOS TYPE command from within VB

                    Well, I guess I know what you now mean about shell having issues.

                    SHELL with the ECHO command worked perfectly on my development XP Pro
                    machine.
                    Send the program to the csutoemr and they try it on an XP machine (don't
                    know if it is pro or home) and he gets an error: File not Found.

                    I will change it to use the Process.StartIn fo and hopefully I won't have
                    this issue again.

                    I will let you know.

                    Darin

                    *** Sent via Developersdex http://www.developersdex.com ***
                    Don't just participate in USENET...get rewarded for it!

                    Comment

                    Working...