Announcement

Collapse
No announcement yet.

register ocxs with out giving names

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • register ocxs with out giving names

    Hi Guys,

    i need to create a script to copy many files and change the location on local drive of many clients, and then register many ocxs, and i want to do that without specifying the names of the files, is there such script / batch / exe file program to do that?
    Thanks & Regards

    Retaliator

    MCSA/MCSE/CCNA
    Computer Science Graduate

  • #2
    Re: register ocxs with out giving names

    Here is a start (batch):
    Code:
    Rem Copy many files:
    xcopy C:\SomeFolder\*.exe C:\OtherFolder\*.*
    xcopy C:\AnotherFolder\*.ocx C:\OtherFolder\*.*
    xcopy C:\DifferentFolder\*.dll C:\OtherFolder\*.*
    Rem Register all OCXs in C:\OtherFolder:
    for %%Z in ("C:\OtherFolder\*.ocx") do regsvr32 /s %%Z

    Comment


    • #3
      Re: register ocxs with out giving names

      what %%z means?
      Thanks & Regards

      Retaliator

      MCSA/MCSE/CCNA
      Computer Science Graduate

      Comment


      • #4
        Re: register ocxs with out giving names

        %%Z is the FullPath and FileName of every OCX file in C:\OtherFolder\
        Type FOR /? at the command prompt for more information on the FOR command.

        Comment


        • #5
          Re: register ocxs with out giving names

          Originally posted by martin77 View Post
          %%Z is the FullPath and FileName of every OCX file in C:\OtherFolder\
          Type FOR /? at the command prompt for more information on the FOR command.
          If you use the For/Do command from a bach you have to use the double %%.
          If you run the For/Do as one command-line from a Dos prompt use a singe % for this Variable.

          The Z here (or a-Z) for naming the variable is CASE-sensitive. If you started with %%Z you cannot use %%z later on.


          - http://www.ss64.com/nt/for2.html
          - http://www.robvanderwoude.com/ntfor.html

          If you not only want to search in "C:\My Other Folder" but also in all the subfolders;
          Code:
          Set Target=C:\My Other Folder
          For /F "Tokens=*" %%Z In ('dir /A-D "%Target%\*.ocx" /S /B') Do regsvr32 /s "%%Z"
          Or even simpler:
          Code:
          Set Target=C:\My Other Folder
          For /R "%Target%" %%Z In ("*.ocx") Do regsvr32 /s "%%Z"
          note:
          In a batch or command-line make sure that there are always quotes around paths (or around one filename or foldername) in command-lines! [.... Do regsvr32 /s "%%Z" ]. If you don't use them, you must work with the short-filename notation (8.3 naming)
          (when adding these quotes avoid that your quotes appears within qoutes.)

          \Rems
          Last edited by Rems; 24th September 2007, 14:39.

          This posting is provided "AS IS" with no warranties, and confers no rights.

          __________________

          ** Remember to give credit where credit's due **
          and leave Reputation Points for meaningful posts

          Comment

          Working...
          X