MS DOS Shell script problem

I have a shell script that acts as a wrapper for a MSI that distributes CR9 runtime. I've had to add something that explicitly copies the dll files that are the heart of the runtime to the system root from a location where the batch file is running from. This is due to problems with Win2k machines, in itself, the msi does what it is supposed to do on WinXP, but not on Win2k, this problem is solved by the explicit copy.

When the script runs, it bombs out on the last line 'for %g in (*.dll) do copy /y %g %windir%\system32'

When run the script dos'nt seem to want to run the line, and just echos 'for g'

What am I doing wrong, apart from not adjusting the MSI file to do what it should be doing (not very good at writing MSI's)
cd /d %~dp0
move /Y "c:\Program Files\Common Files\Crystal Decisions\2.0\bin" "c:\Program Files\Common Files\Crystal Decisions\2.0\bin_old"
msiexec /i Crystal9.msi /quiet
cd /d SysFiles
for %g in (*.dll) do copy /y %g %windir%\system32

Open in new window

LVL 1
Toast_BoyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steve KnightIT ConsultancyCommented:
In a batch file you have to use double %% signs in a for statement (at a cmd.exe prompt you use one % so without I imagine you need
cd /d %~dp0
move /Y "c:\Program Files\Common Files\Crystal Decisions\2.0\bin" "c:\Program Files\Common Files\Crystal Decisions\2.0\bin_old"
msiexec /i Crystal9.msi /quiet
cd /d SysFiles
for %%g in (*.dll) do copy /y %%g %windir%\system32

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Steve KnightIT ConsultancyCommented:
Oops I obviosuly hit undo there and messed up the text, batch file should be OK though.  If there are any spaces in the filenames (unlikely for dll's) you may need some additional "" around the filenames  too to be sure:

for %%g in (*.dll) do copy /y "%%g" "%windir%\system32"

hth

Steve

0
Toast_BoyAuthor Commented:
Thought that it may be something simple like that
0
Steve KnightIT ConsultancyCommented:
No problem, it's a stupid syntax and I've never understood the need for it, just one of those "have to know" things!

Steve
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.