1.

Solve : Creating A Dos Batch File - to do the impossible :)?

Answer»

Hey Guys,

Im looking to use an MS-Dos batch file to register a load of .dll files with regsvr32.exe

Within my job, when I install our custom application, we sometimes have to manually register nearly 50 .dll files on anything between 1 and 50 desktops, so creating a batch file would save a lot of time and hassle.

Is this possible?

Any help would be much appreciated!

Thanks in advancep.s. I'm not a complete n00b 

p.s.s if a batch file isn't able to do the job.... any recomendations?

  Thanks  I expect that it is possible.

If you can register a single dll with

start "regsvr32.exe c:\temp\mydll.dll"
or whatever your dll is called

Then you could create a whole list of them ... if they all lived in one directory, you could even automate that by using a FOR loop to pick them all up

Good luck
GrahamAhhh, makes sense.

would the FOR loop be simple?

When it comes to the FOR command I have a lil trouble understanding it! 

A bit of example code to get me on track would help.. anyone? 

p.s. they all would be in a single directory.

p.s.s feel free to use example1.dll and example2.dll

again all help is appreciated! 

ok, really simple example, replace the path in the brackets with the actual path

RegAll.bat
=======

for %%a in (c:\winnt\*.dll) do start "regsvr32.exe %%a"

=======

The %%a holds the value of the dll name in each iteration (one for ever *.dll found)

This one liner is supposed to be in a batch file, if you paste it directly on to the command line, the %%a should be replaced by %a (thats just 1 % symbol)

Cheers
Grahamok let me give that a try....

Thanks Graham  So, if this was a batch file, then RAN within the c:\Program Files\workfolder\  this would register all .dll files within the directory the batch file was ran?

=======

echo off
%%a in (c:\Program Files\workfolder\*.dll) do start "regsvr32.exe %%a"
pause

=======

Any help would be great! (graham... nudge nudge)  Thats the theory ... I confess I havent ACTUALLY used the start command very much.

Try running it -- but make the first line
Echo On
You will be able to watch it progress - and see what went wrong if it failed.

Oh, the next line starts with 'For' -
for %%a in ("c:\Program Files\workfolder\*.dll") do start "regsvr32.exe %%a"

Ive put quotes around the c:\program files ........ *.dll, because it contains a space, it wouldnt work otherwise

Good luck
Graham
ok one last question.

As we are putting the directory within the code, can the batch file be ran anywhere?

The reason I ask = multi directory. So I could have the code below within the batch file, run the batch on my desktop, and the code below would register all .dll files within the directorys specified?

================

echo on
for %%a in (c:\Program Files\workfolder\*.dll) do start "regsvr32.exe %%a"
pause
for %%a in (c:\Program Files\workfolder\data\*.dll) do start "regsvr32.exe %%a"
pause

================

Thanks again for any help received!  You could (but you omitted the quotes !!) - even better would be this

================

Code: [Select]echo on
for %%a in ("c:\Program Files\workfolder\*.dll" "c:\Program Files\workfolder\data\*.dll") do start "regsvr32.exe %%a"
pause================

unless you particularly wanted the break between processing the 2 directories
Grahamrock and roll thanks Graham.

You a legend

  ok slight problem with our lil code..... 

When the Batch file is executed I get a ton of CMD popups. One for every .dll file that it registers....

Anybody know any code that will either:

1. Keep EVERYTHING in one window?

or

2. not open a seperate window for every .dll file.

============================================================
echo on
for %%a in ("c:\Program Files\workfolder\*.dll" "c:\Program Files\workfolder\data*.dll") do start "regsvr32.exe %%a"
pause
============================================================
p.s. its not because "echo" is on...  Just checked the syntax for Start, the /B param MEANS keep everything in 1 window - thus

============================================================
Code: [Select]echo on
for %%a in ("c:\Program Files\workfolder\*.dll" "c:\Program Files\workfolder\data*.dll") do start /B "regsvr32.exe %%a"
pause
============================================================

Give this a whirl
GrahamFantastic Graham, it works!

As what is shown seems like mumbo jumbo (doesn't state WETHER or not the .dll's are actually being registered)  but after counting the amount of lines it did produce, twas equal to the amount of .dll's in each folder. Im just going to have to wait to test it when I have a machine to test it upon.

Thankyou again Grahami have to register a dll using batch file but the dll must be register as a administrator.

example i want to register xceedzip.dll with command prompt open as a administrator and register the dll



Discussion

No Comment Found