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

RE: [BATCH WORLD] RE: Need help with a batch file.

Expand Messages
  • Hammoud, Adam
    Is there a way to pass an environment variable to an ftp script on NT4? What I am trying to do is set a variable named counter to a value and pass this value
    Message 1 of 14 , Jan 31, 2002
    • 0 Attachment
      Is there a way to pass an environment variable to an ftp script on NT4?
      What I am trying to do is set a variable named counter to a value and pass
      this value to an ftp script.

      Any help would be greatly appreciated.

      Regards,

      Adam

      > -----Original Message-----
      > From: Lamar Morris [SMTP:LamarMorris@...]
      > Sent: Thursday, January 31, 2002 3:36 PM
      > To: batchworld@yahoogroups.com
      > Subject: RE: [BATCH WORLD] RE: Need help with a batch file.
      >
      > Great this is just what I needed, when I get through hacking it I will
      > hopefully post a working script back to the list.
      >
      > Thanks.
      >
      > Lamar
      >
      > -----Original Message-----
      > From: sam.wallace@...
      > [mailto:sam.wallace@...]
      > Sent: Thursday, January 31, 2002 3:57 PM
      > To: batchworld@yahoogroups.com
      > Subject: [BATCH WORLD] RE: Need help with a batch file.
      >
      >
      >
      > Hi Lamar (and Evan),
      >
      > The approach suggested probably will not work very well in this one
      > situation as the part following HKEY_USERS will vary from machine to
      > machine. If you export the key for use in a batch file, you will want to
      > change the first key (S-1-5-21-329068152-1060284298-1957994488-500 in
      > your
      > example) before actually importing it. REG does not work particularly
      > well
      > for this as it will not allow a query on the root key. I resorted to a
      > KIX
      > script (KIX is in the resource kits for NT and 2000) when faced with
      > this
      > problem. I would be happy to share a sample of that code, but would love
      > to
      > hear if anyone else has a method for dealing with this problem with a
      > utility that can be accessed more directly from within a batch file.
      >
      > This file will display a list of the keys immediately off the root of
      > HKEY_USERS for the local machine and type them into a file (THEKEY.TXT).
      > I
      > was unable to redirect the output of a KIX file; it acted for all in the
      > world as if I were pointing it to NUL when I tried. To run it, you must
      > have
      > KIX available to you. Run it by typing KIX32.EXE THEKEY.KIX at the
      > command
      > prompt.
      >
      > THEKEY.KIX
      > $Index = 0
      > :Loop1
      > $KeyName = ENUMKEY("HKEY_USERS", $Index)
      > If @ERROR = 0
      > ? "$KeyName"
      > $RC = Open(4, "THEKEY.TXT",5 ) = 0
      > $RC = WRITELINE(4,'$KeyName' + CHR(13)+CHR(10))
      > $RC = CLOSE (4)
      > $Index = $Index + 1
      > goto Loop1
      > Endif
      >
      > You can use this to create a batch file and run it if you add to the
      > output
      > and change the file name. You will probably want to remove the .DEFAULT
      > listing that will show up when you use this (I use FIND /V to get this
      > done). I hope this helps.
      >
      > Thanks,
      >
      > Sam
      >
      > **************************
      > Easiest way is probably to export the reg key using REGEDIT and put the
      > file
      > in C:\temp (or something that's open), then just put a batch file on
      > each
      > Terminal Server in ALL USERS/STARTUP that calls the reg key to be
      > installed
      > silently.
      > ( regedit /s c:\temp\regkey.reg )
      > That way whenever the person logs on, it corrects their HKCU key.
      >
      > -----Original Message-----
      > From: Lamar Morris [mailto:LamarMorris@...]
      > Sent: Thursday, January 31, 2002 2:57 PM
      > To: batchworld@yahoogroups.com
      > Subject: [BATCH WORLD] Need help with a batch file.
      > Importance: Low
      >
      >
      >
      > Here is my problem. I have 12 Terminal Server servers in my farm. I need
      > to
      > open each of the 800 users hives under HKEY_USERS and change a pointer
      > contained in each hive.
      > Example
      > HKEY_USERS\S-1-5-21-329068152-1060284298-1957994488-500\Software\Macrome
      > dia\
      > Shockwave 8\location\common
      > VALUE = C:\WINNT\system32\Macromed\common\
      > and change the value to C:\WTSRV\system32\Macromed\common\
      >
      > This is just an example of a key I need to change, but is not the real
      > one.
      >
      > Any help would be appreciated.
      >
      >
      > Lamar
      >
      >
      >
      >
      > Regards,
      > Lamar Morris
      > LamarMorris@... <mailto:LamarMorris@...>
      > Texas Instruments Inc.
      > Dallas East Computer Engineering
      > (972)927-7169
      > (888)938-3188
      >
      >
      >
      >
      > To Post a message, send it to: batchworld@...
      >
      > To Unsubscribe, send a blank message to:
      > batchworld-unsubscribe@...
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >
      >
      > To Post a message, send it to: batchworld@...
      >
      > To Unsubscribe, send a blank message to:
      > batchworld-unsubscribe@...
      >
      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      >
    • Michael Marquart
      Assuming the environment variable counter is set then in plain batch you can recreate the FTP script, prior to using it, with ECHO commands IE: @echo off echo
      Message 2 of 14 , Feb 1 3:14 AM
      • 0 Attachment
        Assuming the environment variable counter is set then in plain batch you
        can recreate the FTP script, prior to using it, with ECHO commands

        IE:

        @echo off
        echo command 1>ftp.txt
        echo command 2>>ftp.txt
        echo command 3 %counter%>>ftp.txt
        ftp.exe blah blah correct_switch:ftp.txt


        Does this make sense? Is this suitable?


        --

        Regards,
        Michael


        On Thu, 31 Jan 2002 15:42:06 -0700, "Hammoud, Adam"
        <adam.hammoud@...> wrote:

        >
        >Is there a way to pass an environment variable to an ftp script on NT4?
        >What I am trying to do is set a variable named counter to a value and pass
        >this value to an ftp script.
        >
        >Any help would be greatly appreciated.
        >
        >Regards,
        >
        >Adam
      • Sudeep
        I need to write a script which will automatically attach files & email it. The command to do that is Blat -to test@yahoo.com -attacht -attacht
        Message 3 of 14 , Feb 5 6:46 AM
        • 0 Attachment
          I need to write a script which will automatically attach files & email it.
          The command to do that is
           
          Blat -to test@... -attacht <filename 1> -attacht <filename 2>
           
          Now I have many files in a directory. I want to attach all those files.Therefore i need to construct the above command & then execute
           
          Could anyone help me with this please
          I am running Windows 2000
           
          ----- Original Message -----
          Sent: Friday, February 01, 2002 6:14 AM
          Subject: Re: [BATCH WORLD] RE: Need help with a batch file.


          Assuming the environment variable counter is set then in plain batch you
          can recreate the FTP script, prior to using it, with ECHO commands

          IE:

          @echo off
          echo command 1>ftp.txt
          echo command 2>>ftp.txt
          echo command 3 %counter%>>ftp.txt
          ftp.exe blah blah correct_switch:ftp.txt


          Does this make sense? Is this suitable?


          --

          Regards,
          Michael


          On Thu, 31 Jan 2002 15:42:06 -0700, "Hammoud, Adam"
          <adam.hammoud@...> wrote:

          >
          >Is there a way to pass an environment variable to an ftp script on NT4?
          >What I am trying to do is set a variable named counter to a value and pass
          >this value to an ftp script.
          >
          >Any help would be greatly appreciated.
          >
          >Regards,
          >
          >Adam



          To Post a message, send it to:   batchworld@...

          To Unsubscribe, send a blank message to: batchworld-unsubscribe@...


          Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
        • Michael Marquart
          Blat dummy.txt -to test@yahoo.com -attacht *.* On Tue, 5 Feb 2002 09:46:02 -0500, Sudeep
          Message 4 of 14 , Feb 5 7:47 AM
          • 0 Attachment
            Blat dummy.txt -to test@... -attacht *.*

            On Tue, 5 Feb 2002 09:46:02 -0500, "Sudeep" <sudeepchaudhuri@...>
            wrote:

            >I need to write a script which will automatically attach files & email it.
            >The command to do that is
            >
            >Blat -to test@... -attacht <filename 1> -attacht <filename 2>
            >
            >Now I have many files in a directory. I want to attach all those files.Therefore i need to construct the above command & then execute
            >
            >Could anyone help me with this please
            >I am running Windows 2000
          • Sudeep
            Thanks a lot , i did not realize blat supported *.* I have a directory of files .all the files start with a unique 4 character name ie Filenames will be
            Message 5 of 14 , Feb 5 10:52 AM
            • 0 Attachment
              Thanks a lot , i did not realize blat supported  *.*
               
              I have a directory of files .all the files start with a unique 4 character name
              ie Filenames will be AAAA1234, AAAA4567 , BBBB1234
               
              Based on the 4 char name i want to move the files to a certain directory..i.e. if first 4 chars is AAAA then move AAAA* c:\AAAA\today.
               
              I want to go through the directory list & then move all the files.What i was thinking was first create a list of all unique
              4 char name & then going though the list.
               
              how can i create the list & then how do i go though it one by one
               
              i am using Win 2k
              ----- Original Message -----
              Sent: Tuesday, February 05, 2002 10:47 AM
              Subject: Re: [BATCH WORLD] RE: Need help with a batch file.


              Blat dummy.txt -to test@... -attacht *.*

              On Tue, 5 Feb 2002 09:46:02 -0500, "Sudeep" <sudeepchaudhuri@...>
              wrote:

              >I need to write a script which will automatically attach files & email it.
              >The command to do that is
              >
              >Blat -to test@... -attacht <filename 1> -attacht <filename 2>
              >
              >Now I have many files in a directory. I want to attach all those files.Therefore i need to construct the above command & then execute
              >
              >Could anyone help me with this please
              >I am running Windows 2000



              To Post a message, send it to:   batchworld@...

              To Unsubscribe, send a blank message to: batchworld-unsubscribe@...


              Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

               
            • Michael Marquart
              On Tue, 5 Feb 2002 13:52:28 -0500, Sudeep ... No Worries. BTW, the dummy.txt wasn t directed at you - I am fairly sure that Blat
              Message 6 of 14 , Feb 6 1:53 AM
              • 0 Attachment
                On Tue, 5 Feb 2002 13:52:28 -0500, "Sudeep" <sudeepchaudhuri@...>
                wrote:

                >Thanks a lot , i did not realize blat supported *.*

                No Worries. BTW, the dummy.txt wasn't directed at you - I am fairly sure
                that Blat needs a text file of some kind else it generates an error
                message. Perhaps even a 0 byte file.

                >I have a directory of files .all the files start with a unique 4 character name
                >ie Filenames will be AAAA1234, AAAA4567 , BBBB1234
                >
                >Based on the 4 char name i want to move the files to a certain directory..i.e. if first 4 chars is AAAA then move AAAA* c:\AAAA\today.

                explain the existance of the today directory.


                >I want to go through the directory list & then move all the files.What i was thinking was first create a list of all unique
                >4 char name & then going though the list.
                >
                >how can i create the list & then how do i go though it one by one

                dir /o:n /b>c:\filelist.txt

                >i am using Win 2k

                What limitations are there on third party programs etc?

                --

                Regards,
                Michael
              • Sudeep
                Thanks Michael, I have got this filelist.using your command dir /o:n /b Now how do i go through this.Basically i think it will be some for command by which i
                Message 7 of 14 , Feb 6 7:16 AM
                • 0 Attachment
                  Thanks Michael,
                   
                  I have got this filelist.using your command dir /o:n /b
                  Now how do i go through this.Basically i think it will be some "for" command by which i can go through this list
                   
                  There is no restriction on 3rd party programs.
                   
                  For the today directory , that directory will always be there under each of the 4 char directories .I do not have to create them .
                   
                  it is possible for me to create a list for only the unique 4 char id's
                  Your file list works great but is it possible for me to create a filelist having only the first 4 chars of the filenames & also if the list could contain unique names
                   
                  i.e I have files AAAA1234, AAAA4567, BBBB1234,BBBB4567
                   
                  I want a filelist which contains only AAAA and BBBB
                  Then I can go through this list & do
                  Copy AAAA* c:\AAAA\today
                   
                  Hope u can help me with this
                   
                   
                   
                  PS: Blat requires a dummy file even if it is a 0 byte file. I think we can get around it by using blat - -body " " -t test@...
                   
                  ----- Original Message -----
                  Sent: Wednesday, February 06, 2002 4:53 AM
                  Subject: Re: [BATCH WORLD] RE: Need help with a batch file.

                  On Tue, 5 Feb 2002 13:52:28 -0500, "Sudeep" <sudeepchaudhuri@...>
                  wrote:

                  >Thanks a lot , i did not realize blat supported  *.*

                  No Worries. BTW, the dummy.txt wasn't directed at you - I am fairly sure
                  that Blat needs a text file of some kind else it generates an error
                  message.  Perhaps even a 0 byte file.

                  >I have a directory of files .all the files start with a unique 4 character name
                  >ie Filenames will be AAAA1234, AAAA4567 , BBBB1234
                  >
                  >Based on the 4 char name i want to move the files to a certain directory..i.e. if first 4 chars is AAAA then move AAAA*  c:\AAAA\today.

                  explain the existance of the today directory.


                  >I want to go through the directory list & then move all the files.What i was thinking was first create a list of all unique
                  >4 char name & then going though the list.
                  >
                  >how can i create the list & then how do i go though it one by one

                  dir /o:n /b>c:\filelist.txt

                  >i am using Win 2k

                  What limitations are there on third party programs etc?

                  --

                  Regards,
                  Michael



                  To Post a message, send it to:   batchworld@...

                  To Unsubscribe, send a blank message to: batchworld-unsubscribe@...


                  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
                • Michael Marquart
                  Save this this basic script to a text file called output.bas and use Qbasic with it in the directory concerned. EG QBASIC /RUN OUTPUT.BAS It is
                  Message 8 of 14 , Feb 6 7:42 AM
                  • 0 Attachment
                    Save this this basic script to a text file called output.bas and use Qbasic
                    with it in the directory concerned. EG QBASIC /RUN OUTPUT.BAS

                    It is non-destructive and will create a batch file called OUTPUT.BAT
                    containing the required commands. Examine it and test it on a copy of your
                    data to see if it is right for your application.
                    (It also creates a temporary file called !_~_!.001 and uses the system SORT
                    command, in case the directory is too large to be sorted by the internal
                    DIR sort function)

                    All care taken, but owner onus applies.

                    '===========================================================================
                    filespec$ = "*.*"
                    filetemp$ = "!_~_!.001"
                    fileout$ = "output.bat"
                    SHELL "dir " + filespec$ + " /a:-d /b /o:n /-p|sort>" + filetemp$

                    OPEN filetemp$ FOR INPUT AS #1
                    OPEN fileout$ FOR OUTPUT AS #2
                    PRINT #2, "@echo off"
                    DO WHILE NOT EOF(1)
                    LINE INPUT #1, b$: IF LEFT$(a$, 4) = LEFT$(b$, 4) THEN DUP = 1 ELSE DUP = 0
                    IF DUP = 0 THEN
                    PRINT #2, "md "; LEFT$(b$, 4)
                    PRINT #2, "move "; LEFT$(b$, 4); "*.* "; LEFT$(b$, 4)
                    END IF
                    a$ = b$
                    LOOP
                    CLOSE
                    SYSTEM
                    '==============================================================================



                    On Wed, 6 Feb 2002 10:16:15 -0500, "Sudeep" <sudeepchaudhuri@...>
                    wrote:

                    >Thanks Michael,
                    >
                    >I have got this filelist.using your command dir /o:n /b
                    >Now how do i go through this.Basically i think it will be some "for" command by which i can go through this list
                    >
                    >There is no restriction on 3rd party programs.
                    >
                    >For the today directory , that directory will always be there under each of the 4 char directories .I do not have to create them .
                    >
                    >it is possible for me to create a list for only the unique 4 char id's
                    >Your file list works great but is it possible for me to create a filelist having only the first 4 chars of the filenames & also if the list could contain unique names
                    >
                    >i.e I have files AAAA1234, AAAA4567, BBBB1234,BBBB4567
                    >
                    >I want a filelist which contains only AAAA and BBBB
                    >Then I can go through this list & do
                    >Copy AAAA* c:\AAAA\today
                    >
                    >Hope u can help me with this
                    >
                    >
                    >
                    >PS: Blat requires a dummy file even if it is a 0 byte file. I think we can get around it by using blat - -body " " -t test@...
                    >
                    > ----- Original Message -----
                    > From: Michael Marquart
                    > To: batchworld@yahoogroups.com
                    > Sent: Wednesday, February 06, 2002 4:53 AM
                    > Subject: Re: [BATCH WORLD] RE: Need help with a batch file.
                    >
                    >
                    > On Tue, 5 Feb 2002 13:52:28 -0500, "Sudeep" <sudeepchaudhuri@...>
                    > wrote:
                    >
                    > >Thanks a lot , i did not realize blat supported *.*
                    >
                    > No Worries. BTW, the dummy.txt wasn't directed at you - I am fairly sure
                    > that Blat needs a text file of some kind else it generates an error
                    > message. Perhaps even a 0 byte file.
                    >
                    > >I have a directory of files .all the files start with a unique 4 character name
                    > >ie Filenames will be AAAA1234, AAAA4567 , BBBB1234
                    > >
                    > >Based on the 4 char name i want to move the files to a certain directory..i.e. if first 4 chars is AAAA then move AAAA* c:\AAAA\today.
                    >
                    > explain the existance of the today directory.
                    >
                    >
                    > >I want to go through the directory list & then move all the files.What i was thinking was first create a list of all unique
                    > >4 char name & then going though the list.
                    > >
                    > >how can i create the list & then how do i go though it one by one
                    >
                    > dir /o:n /b>c:\filelist.txt
                    >
                    > >i am using Win 2k
                    >
                    > What limitations are there on third party programs etc?
                    >
                  • Michael Marquart
                    Sudeep, I didn t read your request closely enough and thought you wished to create the directories too. The following script is quite similar but only copies
                    Message 9 of 14 , Feb 6 8:09 AM
                    • 0 Attachment
                      Sudeep, I didn't read your request closely enough and thought you wished to
                      create the directories too. The following script is quite similar but only
                      copies the appropriate files to "c:\AAAA\today" for example in the batch
                      file.

                      '===========================================================================
                      filespec$ = "*.*"
                      filetemp$ = "!_~_!.001"
                      fileout$ = "output.bat"
                      SHELL "dir " + filespec$ + " /a:-d /b /o:n /-p|sort>" + filetemp$

                      OPEN filetemp$ FOR INPUT AS #1
                      OPEN fileout$ FOR OUTPUT AS #2
                      PRINT #2, "@echo off"
                      DO WHILE NOT EOF(1)
                      LINE INPUT #1, b$: IF LEFT$(a$, 4) = LEFT$(b$, 4) THEN DUP = 1 ELSE DUP = 0
                      IF DUP = 0 THEN
                      PRINT #2, "copy "; LEFT$(b$, 4); "*.* c:\"; LEFT$(b$, 4);"\today"
                      END IF
                      a$ = b$
                      LOOP
                      CLOSE
                      SYSTEM
                      '===========================================================================




                      On Thu, 07 Feb 2002 02:42:08 +1100, Michael Marquart <micm@...>
                      wrote:

                      >
                      >Save this this basic script to a text file called output.bas and use Qbasic
                      >with it in the directory concerned. EG QBASIC /RUN OUTPUT.BAS
                      >
                      >It is non-destructive and will create a batch file called OUTPUT.BAT
                      >containing the required commands. Examine it and test it on a copy of your
                      >data to see if it is right for your application.
                      >(It also creates a temporary file called !_~_!.001 and uses the system SORT
                      >command, in case the directory is too large to be sorted by the internal
                      >DIR sort function)
                      >
                      >All care taken, but owner onus applies.
                      >
                      >
                      >
                      >
                      >On Wed, 6 Feb 2002 10:16:15 -0500, "Sudeep" <sudeepchaudhuri@...>
                      >wrote:
                      >
                      >>Thanks Michael,
                      >>
                      >>I have got this filelist.using your command dir /o:n /b
                      >>Now how do i go through this.Basically i think it will be some "for" command by which i can go through this list
                      >>
                      >>There is no restriction on 3rd party programs.
                      >>
                      >>For the today directory , that directory will always be there under each of the 4 char directories .I do not have to create them .
                      >>
                      >>it is possible for me to create a list for only the unique 4 char id's
                      >>Your file list works great but is it possible for me to create a filelist having only the first 4 chars of the filenames & also if the list could contain unique names
                      >>
                      >>i.e I have files AAAA1234, AAAA4567, BBBB1234,BBBB4567
                      >>
                      >>I want a filelist which contains only AAAA and BBBB
                      >>Then I can go through this list & do
                      >>Copy AAAA* c:\AAAA\today
                      >>
                      >>Hope u can help me with this
                      >>
                      >>
                      >>
                      >>PS: Blat requires a dummy file even if it is a 0 byte file. I think we can get around it by using blat - -body " " -t test@...
                      >>
                      >> ----- Original Message -----
                      >> From: Michael Marquart
                      >> To: batchworld@yahoogroups.com
                      >> Sent: Wednesday, February 06, 2002 4:53 AM
                      >> Subject: Re: [BATCH WORLD] RE: Need help with a batch file.
                      >>
                      >>
                      >> On Tue, 5 Feb 2002 13:52:28 -0500, "Sudeep" <sudeepchaudhuri@...>
                      >> wrote:
                      >>
                      >> >Thanks a lot , i did not realize blat supported *.*
                      >>
                      >> No Worries. BTW, the dummy.txt wasn't directed at you - I am fairly sure
                      >> that Blat needs a text file of some kind else it generates an error
                      >> message. Perhaps even a 0 byte file.
                      >>
                      >> >I have a directory of files .all the files start with a unique 4 character name
                      >> >ie Filenames will be AAAA1234, AAAA4567 , BBBB1234
                      >> >
                      >> >Based on the 4 char name i want to move the files to a certain directory..i.e. if first 4 chars is AAAA then move AAAA* c:\AAAA\today.
                      >>
                      >> explain the existance of the today directory.
                      >>
                      >>
                      >> >I want to go through the directory list & then move all the files.What i was thinking was first create a list of all unique
                      >> >4 char name & then going though the list.
                      >> >
                      >> >how can i create the list & then how do i go though it one by one
                      >>
                      >> dir /o:n /b>c:\filelist.txt
                      >>
                      >> >i am using Win 2k
                      >>
                      >> What limitations are there on third party programs etc?
                    • Michael Marquart
                      Sudeep, I d appreciate some feedback when you ve had time to test the script, to know if it worked or not. On Thu, 07 Feb 2002 03:09:19 +1100, Michael Marquart
                      Message 10 of 14 , Feb 7 9:07 AM
                      • 0 Attachment
                        Sudeep, I'd appreciate some feedback when you've had time to test the
                        script, to know if it worked or not.


                        On Thu, 07 Feb 2002 03:09:19 +1100, Michael Marquart <micm@...>
                        wrote:

                        >The following script is quite similar but only
                        >copies the appropriate files to "c:\AAAA\today" for example in the batch
                        >file.
                      • arun prasad
                        __________________________________________________ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com
                        Message 11 of 14 , Feb 16 12:16 PM
                        • 0 Attachment
                          __________________________________________________
                          Do You Yahoo!?
                          Yahoo! Sports - Coverage of the 2002 Olympic Games
                          http://sports.yahoo.com
                        Your message has been successfully submitted and would be delivered to recipients shortly.