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

Author Topic: Batch Commands  (Read 8604 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.

                    Salmon Trout

                    • Guest
                    Re: Batch Commands
                    « Reply #15 on: March 26, 2010, 05:39:19 PM »
                    You changed the word damned to asterisk-censored-asterisk??? Is this 1810? Is my calendar broken? What planet are you from? Planet God Hates Profanity?






                    greg



                      Intermediate

                      Thanked: 7
                      Re: Batch Commands
                      « Reply #16 on: March 26, 2010, 06:23:04 PM »
                      I don't think he realized that he was on his Greg account and not his other account when he was complementing himself.

                      Quote from: Helpmeh on March 22, 2010, 04:22:49 PM
                      "Maybe he will post to deny these accusations."


                      Greg Explains:
                      I sent the bogus information about Greg (me) having several current logins to the CH staff. I used the abuse button  to send the message.

                      I have never had more than one current login at CH.

                      The CH staff can verify this with my ip address. 

                      Only the CH staff has my ip address.

                      Helpmeh is not CH staff
                      Have a Nice Day

                      Helpmeh



                        Guru

                      • Roar.
                      • Thanked: 123
                        • Yes
                        • Yes
                      • Computer: Specs
                      • Experience: Familiar
                      • OS: Windows 8
                      Re: Batch Commands
                      « Reply #17 on: March 26, 2010, 06:47:20 PM »
                      You changed the word damned to asterisk-censored-asterisk??? Is this 1810? Is my calendar broken? What planet are you from? Planet God Hates Profanity?






                      No, I have the word filter enabled. I didn't change what I saw in any way.
                      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 #18 on: March 26, 2010, 07:03:12 PM »
                        No, I have the word filter enabled. I didn't change what I saw in any way.

                        Helpmeh,

                        Salmon Trout's "asterisk-censored-asterisk" comment was for the CH staff.
                        Have a Nice Day

                        Helpmeh



                          Guru

                        • Roar.
                        • Thanked: 123
                          • Yes
                          • Yes
                        • Computer: Specs
                        • Experience: Familiar
                        • OS: Windows 8
                        Re: Batch Commands
                        « Reply #19 on: March 26, 2010, 07:24:29 PM »
                        Helpmeh,

                        Salmon Trout's "asterisk-censored-asterisk" comment was for the CH staff.
                        No. He was asking why I filtered out a word he wrote, when in fact the system filtered it, but did not un-filter it for him.
                        Where's MagicSpeed?
                        Quote from: 'matt'
                        He's playing a game called IRL. Great graphics, *censored* gameplay.

                        BC_Programmer


                          Mastermind
                        • Typing is no substitute for thinking.
                        • Thanked: 1140
                          • Yes
                          • Yes
                          • BC-Programming.com
                        • Certifications: List
                        • Computer: Specs
                        • Experience: Beginner
                        • OS: Windows 11
                        Re: Batch Commands
                        « Reply #20 on: March 26, 2010, 07:32:11 PM »
                        What is the point of greg's posts on here? They do absolutely nothing.


                        I usually just sort of shake my head in a dissapointing way, like a grandson when they finally realize that their grandfathers best friend is a old sock puppet and/or imaginary.

                        re: the "censored" thing, I find that it does that when you use the quote button, regardless of profile settings.

                        Either way, the meaningless demonstration of how Greg/Whoever doesn't understand that not everybody in the world has this lpr program nor access to this print server is rather entertaining, especially given the delicious hypocritical twist since he constantly uses "sed" and other tools with absolutely no mention of their source or where to get them, or really, anything other then a post containg his code and the output from a completely different set of code. And of course complaining about how other peoples solutions don't work after he butchers them.

                        IN any case, All I can suggest is the use of quotes around "%1" in the lpr command.
                        I was trying to dereference Null Pointers before it was cool.

                        greg



                          Intermediate

                          Thanked: 7
                          Re: Batch Commands
                          « Reply #21 on: March 27, 2010, 06:08:39 PM »

                          IN any case, All I can suggest is the use of quotes around "%1" in the lpr command.

                          BC is a sad case. All BC can do is repeat the misinformation started by other troublemakers.

                          Greg has not had more than one current username. "OLD sock puppet" is an insult ( abusive post ).
                           
                          Before anyone can be a "sock puppet" they need more than one current "username."  BC cannot list any current "usernames" used by Greg other than Greg.  Where are the posts ( BC ) where Greg is using another "username?"

                          BC pretends he is a computer programmer that uses "C" and many other programming languages.

                          But BC has never used or heard of Sed.  Sed is a Unix utility that was created by AT&T in 1970. Anyone who has used Linux or Unix has used Sed.

                          BC can always tells us what is wrong ( and his idea is usually false ) but seldom offers any suggestions for the Original Poster of any question at CH.

                          The only suggestion by BC had for the Lpr problem was to repeat what Helpmeh had already suggested.

                          __________________________________

                          reference:
                          http://www.yourdictionary.com/computer/sock-puppet
                          « Last Edit: March 27, 2010, 06:58:57 PM by greg »
                          Have a Nice Day