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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Steve KnightConnect With a Mentor IT 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
 
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
All Courses

From novice to tech pro — start learning today.