Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch Commands  (Read 8638 times)

0 Members and 1 Guest are viewing this topic.

Patron0119

    Topic Starter


    Starter

    Batch Commands
    « on: March 24, 2010, 11:54:56 AM »
    I have a batch file that will lpr a file to a unix printer controller. After the file is sent to the printer, it must moved to a History folder for archiving. My file is three levels down in a directory and the History folder is in fourth level down of the same directory. If I lpr the file from a two levels down folder and my History is on the third level down it will work, but if lpr from a third level down and my History is on the forth level down it will not work. See my batch script below.

    rem
    :START
    IF %1=="" GOTO END
    lpr -S10.251.22.83 -Pp1  -o l %1
    MOVE %1 %~DP1history\
    ECHO FILE %1 Sent to Printer
    SHIFT
    GOTO START
    :END
    rem
    rem
    rem all done
    rem

    greg



      Intermediate

      Thanked: 7
      Re: Batch Commands
      « Reply #1 on: March 24, 2010, 04:00:26 PM »
      If I lpr the file from a two levels down folder and my History is on the third level down it will work, but if lpr from a third level down and my History is on the forth level down it will not work. See my batch script below.

      Show the complete path to each command and file in your code.

      Or

      Add all paths to the the search path.


      C:\>path
      PATH=C:\Program Files\Windows Resource Kits\Tools\;C:\WINDOWS\system32;C:\WINDOW
      S;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;c:\bin;C:\WINDOWS;C:
      \bin;C:\pctools;C:\tc;C:\tc\bin;C:\DOS;C:\GMKW;C:\MOUSE

      C:\>echo %PATH%
      C:\Program Files\Windows Resource Kits\Tools\;C:\WINDOWS\system32;C:\WINDOWS;C:\
      WINDOWS\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;c:\bin;C:\WINDOWS;C:\bin;
      C:\pctools;C:\tc;C:\tc\bin;C:\DOS;C:\GMKW;C:\MOUSE

      C:\>
      Have a Nice Day

      Patron0119

        Topic Starter


        Starter

        Re: Batch Commands
        « Reply #2 on: March 25, 2010, 10:07:24 AM »
        Thanks, Greg.

        I noticed that one of the paths created by my friend was looking as follow:

        P:\myfiles\2bmove\regular letters\archive "DOS doesn't like the blank spaces. I changed to as follow, the it worked"

        P:\myfiles\2bmove\regular_letters\archive

        wbrost



          Intermediate
        • Thanked: 11
          Re: Batch Commands
          « Reply #3 on: March 25, 2010, 10:39:13 AM »
          you could have also put the path in quotes or used 8dot3 names. to get the path in 8dot3 type:

          dir /x

          for more information type

          dir /?

          Helpmeh



            Guru

          • Roar.
          • Thanked: 123
            • Yes
            • Yes
          • Computer: Specs
          • Experience: Familiar
          • OS: Windows 8
          Re: Batch Commands
          « Reply #4 on: March 25, 2010, 03:17:17 PM »
          And one thing,
          if %1=="" GOTO END

          will never work. This will:

          if "%1"=="" GOTO END

          Where's MagicSpeed?
          Quote from: 'matt'
          He's playing a game called IRL. Great graphics, *censored* gameplay.

          greg



            Intermediate

            Thanked: 7
            Re: Batch Commands
            « Reply #5 on: March 25, 2010, 07:50:10 PM »


            C:\batch>type   lp25.bat
            Code: [Select]
            @echo off
            :START
            IF "%1"=="" (
            echo no argument
            GOTO END
            )
            lpr -S10.251.22.83 -Pp1  -o l %1
            rem MOVE %1 %~DP1history\
            ECHO FILE %1 Sent to Printer
            SHIFT
            GOTO START
            :END
            echo END no argument

            Output:

            C:\batch> lp25.bat abc.txt abc5.txt arc.txt
            Error: print server unreachable or specified printer does not exist.

            FILE abc.txt Sent to Printer
            Error: print server unreachable or specified printer does not exist.

            FILE abc5.txt Sent to Printer
            Error: print server unreachable or specified printer does not exist.

            FILE arc.txt Sent to Printer
            no argument
            END no argument

            C:\batch>
            Have a Nice Day

            Salmon Trout

            • Guest
            Re: Batch Commands
            « Reply #6 on: March 26, 2010, 12:14:10 PM »
            What is the point of greg's posts on here? They do absolutely nothing.

            greg



              Intermediate

              Thanked: 7
              Re: Batch Commands
              « Reply #7 on: March 26, 2010, 12:39:13 PM »
              What is the point of greg's posts on here? They do absolutely nothing.


              What solution or suggestion does Salmon Trout have for Patron0119, the original  poster?


              Patron0119, the original poster asked:

              "If lpr from a third level down and my History is on the forth level down it will not work? "

              So Salmon Trout what is wrong with the lpr command?

              How would Salmon Trout  fix  the problem with the lpr command?

              Please, Salmon Trout give us the solution for the lpr command.

              Thanks for your help Salmon Trout.

              Have a Nice Day

              Salmon Trout

              • Guest
              Re: Batch Commands
              « Reply #8 on: March 26, 2010, 01:37:15 PM »
              What solution or suggestion does Salmon Trout have for Patron0119, the original  poster?

              Don't evade the question.

              greg



                Intermediate

                Thanked: 7
                Re: Batch Commands
                « Reply #9 on: March 26, 2010, 01:43:39 PM »
                What is the point of greg's posts on here? .


                Greg's posts provided suggestions why the lpr command did
                not work correctly.

                Salmon Trout has provided no suggestions of how to fix the lpr
                problem.


                The evasion is by Salmon Trout not Greg.
                Have a Nice Day

                Salmon Trout

                • Guest
                Re: Batch Commands
                « Reply #10 on: March 26, 2010, 01:55:01 PM »
                Greg's posts provided suggestions why the lpr command did
                not work correctly.

                They did not.

                greg



                  Intermediate

                  Thanked: 7
                  Re: Batch Commands
                  « Reply #11 on: March 26, 2010, 02:52:48 PM »
                  They did.


                  Thanks for the suggestions by Salmon Trout of how to fix the Lpr
                  problem.

                  Patron0119, The Original Poster, appreciates the help offered by Salmon Trout.
                  Have a Nice Day

                  Salmon Trout

                  • Guest
                  Re: Batch Commands
                  « Reply #12 on: March 26, 2010, 02:56:06 PM »
                  greg, it is about time you stopped speaking for the "Original Poster" all the *censored* time. Let them speak for themselves. It is stupid and pointless and it makes you seem [even] more and more like a time wasting loony.

                  greg



                    Intermediate

                    Thanked: 7
                    Re: Batch Commands
                    « Reply #13 on: March 26, 2010, 03:03:53 PM »
                    greg, it is about time you stopped speaking for the "Original Poster" all the *censored* time. Let them speak for themselves.


                    Salmon Trout thanks for the kind words.  Salmon Trout provides added value to the CH board. No abuse by Salmon Trout.

                    Salmon Trout is a gentleman and scholar.

                    Have a Nice Day

                    Helpmeh



                      Guru

                    • Roar.
                    • Thanked: 123
                      • Yes
                      • Yes
                    • Computer: Specs
                    • Experience: Familiar
                    • OS: Windows 8
                    Re: Batch Commands
                    « Reply #14 on: March 26, 2010, 03:55:30 PM »
                    greg, it is about time you stopped speaking for the "Original Poster" all the *censored* time. Let them speak for themselves. It is stupid and pointless and it makes you seem [even] more and more like a time wasting loony.

                    I don't think he realized that he was on his Greg account and not his other account when he was complementing himself.
                    Where's MagicSpeed?
                    Quote from: 'matt'
                    He's playing a game called IRL. Great graphics, *censored* gameplay.