LVF
(Fresh Scripter)
2003-07-11 03:38 PM
Need help to streamline my script

I need to determine the CDROM drive and this is what i've got sofar. The problem is that if the hosts file is copy/backuped the script wants to copy it from every drive. Any suggestions are welcome.

variables:
$host2k = "%systemroot%\system32\drivers\etc"

Script

$Array=d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
For Each $element In $Array
Shell 'cmd /c copy "$host2k\hosts" "$host2k\hosts.org"' ; backup original hosts file
Shell 'cmd /c copy "$element:\hosts" "$host2k\hosts"' ; implement new hosts file
Next
GoTo end


Sealeopard
(KiX Master)
2003-07-11 03:42 PM
Re: Need help to streamline my script

Would you mind providing us the 'big picture'? I don't see anything that relates to a CD-ROM drive.

Additionally, please take a look at the UDF Forum as a UDF for determining drives types, like CD-ROM drives, has laready been posted.

Also, please use the build-in COPY command instead of SHELLing out.

Finally, why do you copy the files to all driveletters?

And please do not use variables inside strings and refrain from using GOTOs.


LVF
(Fresh Scripter)
2003-07-11 03:51 PM
Re: Need help to streamline my script

You're absolutly wright! I try to make a script which installs IE6 for the home computer of my users and it's must copy a new hosts file for access to the company network. The problem is that not everyone had the D-drive as his CD-ROM drive. j.meijer@lvf.nl

Les
(KiX Master)
2003-07-11 03:55 PM
Re: Need help to streamline my script

Well, if you are running the script from the CD drive, @ScriptDir would tell you what it is.

Sealeopard
(KiX Master)
2003-07-11 03:58 PM
Re: Need help to streamline my script

Okay, so let me rephrase wht you try to do.

You provide users with a CD-ROM containing an IE6 install (hopefully prepared with IEAK for completely silent install!). After the IE6 install, you also want to copy over the HOSTS file from the same CD-ROM.

Q: Where is the script being run from?

My solution: KiXtart and the script are included in that CD-ROM. User clicks on an INSTALLME.BAT file which in turn starts the KiXtart script. Thus, the @SCRIPTDIR macro includes the dirveletter of the CD-rOM dirve as it is being started from there. Then LEFT(@SCRIPTDIR,1) will give you the drive letter.

Alternatively, see the following UDFs: WshEnumDrives() - Enumerate drives on your local machine and DriveEnum() - return a list of specific, connected drive types

Finally, there might be a way to include the HOSTS file update into the IE install though the IEAK. I highly recommend to use IEAK for the deployment, giving users choices is a risk!


LVF
(Fresh Scripter)
2003-07-11 04:14 PM
Re: Need help to streamline my script

Indeed @SCRIPTDIR is what i need.
It's an autorun cd which calls a kix script.
The user see a menu to choose his OS and the script will backup/copies the hosts file, next it wil determine which version of IE is used. If it's below version 6 or 128-bits encryption, it's installing IE6 or a patch to 128-bits encryption (W95).

Thanks a lot also for mention IEAK.

Greetz


Sealeopard
(KiX Master)
2003-07-11 04:17 PM
Re: Need help to streamline my script

Automate OS detection with @PRODUCTTYPE or use the OSID() UDF.