ArjanDotOrg Posted September 16, 2005 Share Posted September 16, 2005 (edited) Can anybody help me with this?- I run WPI from %cdrom%\$OEM$\$1\install\WPI\- Programspath = %cdrom%\INSTALL\- WIN51 file in the root of the CD.Whenever I try to install a program, it looks for the files in %cdrom%\$OEM$\$1\install\WPI\INSTALL\ and not in %cdrom%\INSTALL\.my WPI.CMD:@ECHO OFFREM Example, how to look for CDROM-drive. Must have WPI.ico at the root of the CD.for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\WIN51 set CDROM=%%i:echo Found CD-Rom as drive %CDROM%REM Determine the WPI startup path. REM if wpi should run off the cd the replace %~dp0 with %cdrom%.set wpipath=%cdrom%\$OEM$\$1\install\WPIREM Hide this command window.%wpipath%\Tools\cmdow.exe @ /hidREM Force resolution to needed size for wpi interface.--start %wpipath%\Tools\VideoChanger.exe 1280x1024x32@85 -qREM Font installation - the smooth and customizable way.--start /wait %wpipath%\Tools\fonts\fontinstaller.exeREM Special registry tweak needed.regedit /s "%wpipath%\common\wpi.regREM Make WPI directory the current directory.for /f "delims=: tokens=1" %%i in ("%wpipath%") do %%i:cd "%wpipath%"REM Start WPI and wait for its endstart /wait %windir%\system32\mshta.exe "%cdrom%\$OEM$\$1\install\WPI\wpi.hta"REM Cleaning up the desktop.REM del /s/q "%userprofile%\desktop\*.lnk"REM Rebooting the sytem to finalize the installation process.--shutdown.exe -r -f -t 30 -c "To finish installations WPI will now reboot in 30 sec..."exit:endMy GENERATE.JS:var WshShell = new ActiveXObject("wscript.shell");var fso = new ActiveXObject("Scripting.FileSystemObject");var WshEnv = WshShell.Environment("PROCESS");var cddrv = new String(); cddrv="";var foundCDdrv = false;var audioshell = new ActiveXObject("WScript.shell"); var runaudio = "";var runaudioprogram = "";runaudio=1;function SetScriptWaitTimeout(timeout) // max is 4294967295{ position="generate.js"; var val=0; var KeyBase = "HKCU\\Software\\Microsoft\\Internet Explorer\\Styles\\MaxScriptStatements"; try { if (timeout<0) { WshShell.regDelete(KeyBase); return; } try { val = WshShell.regRead(KeyBase); } catch (exc) { if (timeout==0 || !timeout) timeout = 0x7fffffff; WshShell.regWrite(KeyBase, timeout, "REG_DWORD"); } } catch (ex2) {}}function FileExists(filespec){ position = "generate.js"; return fso.FileExists(filespec);}function GetCDRomDriveLetters(){ position = "generate.js"; var li, en; li = new Array(); en = new Enumerator(fso.Drives); for (; !en.atEnd(); en.moveNext()) { ite = en.item(); if (ite.DriveType == 4) { li[li.length++]=(ite.DriveLetter + ":"); } } return li;}function FindCDRom(){ position = "generate.js"; var i, li; if (foundCDdrv) return cddrv; li = GetCDRomDriveLetters(); for (i=0; i<li.length; i++) { if (FileExists(li[i]+'\\WIN51')) { cddrv = li[i]; debug("Found CDROM as drive " + cddrv,1,2); } } if (cddrv=="") { a = fso.GetAbsolutePathName("."); while (a.length>=3) { //debug("Trying ... " + a, 1); if (FileExists(a+'\\WIN51')) { cddrv=a; debug("Found CDROM as folder " + cddrv,1,2); break; } if (a.length==3) break; a = a + "\\.."; a = fso.GetAbsolutePathName(a); } } if (cddrv=="") { cddrv = WshShell.RegRead("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Setup\\SourcePath") + "\\"; cddrv = cddrv.substr(0,3); debug("Found CDROM as from registry " + cddrv,1,2); } foundCDdrv = true; return cddrv;}function replpath(u) { position = "generate.js"; cddrv = FindCDRom(); sysdrv = WshEnv("SYSTEMDRIVE") + "\\"; windir = WshEnv("WINDIR") + "\\"; programfiles = WshEnv("PROGRAMFILES") + "\\"; sysdir = WshEnv("WINDIR") + "\\system32\\"; allusersprofile = WshEnv("ALLUSERSPROFILE") + "\\"; userprofile = WshEnv("USERPROFILE") + "\\"; appdata = WshEnv("APPDATA") + "\\"; commonprogramfiles = WshEnv("CommonProgramFiles") + "\\"; rs = new String(); rs = u; rs = rs.replace(/%cdrom%/gi, cddrv); rs = rs.replace(/%systemdrive%/gi,sysdrv); rs = rs.replace(/%windir%/gi, windir); rs = rs.replace(/%programfiles%/gi,programfiles); rs = rs.replace(/%sysdir%/gi, sysdir); rs = rs.replace(/%allusersprofile%/gi, allusersprofile); rs = rs.replace(/%userprofile%/gi,userprofile); rs = rs.replace(/%appdata%/gi, appdata); rs = rs.replace(/%commonprogramfiles%/gi, commonprogramfiles); return rs;}function path(u) { position = "generate.js"; if((u[0] == "systemdrive") ||(u[0] == "programfiles") ||(u[0] == "windir") ||(u[0] == "cdrom") ||(u[0] == "")) { pth = new String(); pth = u[0]; u[0] = pth.toLowerCase(); if(u[0] == "systemdrive") return WshEnv("SYSTEMDRIVE") + "\\" + u[1] if(u[0] == "programfiles") return WshEnv("PROGRAMFILES") + "\\" + u[1] if(u[0] == "windir") return WshEnv("WINDIR") + "\\" + u[1] if(u[0] == "cdrom"){ TempSource = new String(); TempSource = WshShell.RegRead("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Setup\\SourcePath"); TempSource = TempSource + "\\"; if (discPath == 'root'){ TempSource = TempSource.substr(0,3) + u[1]; // return the drive letter of the CD/DVD drive. eg. D:\ | E:\ | F:\ etc. } else{ TempSource = TempSource + u[1]; } TempSource.replace("\\\\","\\"); return TempSource } if(u[0] == "") return u[1] } else { if (u[1]==null || u[1]=="") return replpath(u[0]); else alert("Drive not found."); } return "";}function CreateFile(arg) { position = "generate.js"; var KeyBase = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx"; var j = 0; var msg; var programs = new Array(); if (arg==null || arg) window.alert(getText(msgStartInstall)); if (arg=='exit'){ // when pressing exit button, removes default checked checkboxes remChecks(); } for ( i = 1; prog[i]!=null; i++ ) { if (forc[i]!=null && forc[i] == "yes"){ // check the checkbox for an app if it is forced setChecked(i); } if (document.getElementById("chkbox"+i) && document.getElementById("chkbox"+i).checked) { programs[programs.length++] = new program(i); debug("Selecting: " + programs[programs.length-1].prog + " - " + programs[programs.length-1].ordr,1); } } if (sorting) { debug("Sort",1); if (installByCategory) programs.sort(SortByCat); else programs.sort(SortByOrdr); } for ( i = 0; i<programs.length && programs[i]!=null; i++ ) debug(i+1 + ".: " +programs[i].ordr + " - " + programs[i].prog,1); debug("Installing...",1); for ( i = 0; i<programs.length && programs[i]!=null; i++ ) { j++; if (sorting && !installByCategory) e = programs[i].ordr; else { e = '0' + i; while (e.length<4) e = "0" + e; } WshShell.regWrite(KeyBase + "\\"+e+"\\", programs[i].prog, "REG_SZ"); if (true) { // set to false, if you want just the display but no real installs if ((programs[i].regb != null)&&(path(programs[i].regb) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\1","REGEDIT /S "+path(programs[i].regb), "REG_SZ"); if ((programs[i].cmd1 != null)&&(path(programs[i].cmd1) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\2",substituteCommand(programs[i].cmd1), "REG_SZ"); if ((programs[i].cmd2 != null)&&(path(programs[i].cmd2) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\3",substituteCommand(programs[i].cmd2), "REG_SZ"); if ((programs[i].cmd3 != null)&&(path(programs[i].cmd3) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\4",substituteCommand(programs[i].cmd3), "REG_SZ"); if ((programs[i].cmd4 != null)&&(path(programs[i].cmd4) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\5",substituteCommand(programs[i].cmd4), "REG_SZ"); if ((programs[i].cmd5 != null)&&(path(programs[i].cmd5) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\6",substituteCommand(programs[i].cmd5), "REG_SZ"); if ((programs[i].cmd6 != null)&&(path(programs[i].cmd6) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\7",substituteCommand(programs[i].cmd6), "REG_SZ"); if ((programs[i].rega != null)&&(path(programs[i].rega) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\8","REGEDIT /S "+path(programs[i].rega), "REG_SZ"); } if (runaudio==1){ runaudio=0; if (showmpINSBtn == 1) { runaudioprogram = ".\\audio.exe" audioshell.run(runaudioprogram, 1, true); } } if (j==appsPerInstallWindow) // call RunOnceEx every 15 apps, so that the window doesn't grow too big { WshShell.regWrite(KeyBase + "\\TITLE", getText(txtRunOnceExTitle), "REG_SZ"); window.moveTo(10000,10000); if (!debugOn) WshShell.Run("rundll32.exe iernonce.dll,RunOnceExProcess", 10, true); j=0; } } //Launch the last RunOnceEx process we just wrote keys for and exit WshShell.regWrite(KeyBase + "\\TITLE", getText(txtRunOnceExTitle), "REG_SZ"); window.moveTo(10000,10000); if (!debugOn) WshShell.Run("rundll32.exe iernonce.dll,RunOnceExProcess", 10, true); window.moveTo(0,0); SetScriptWaitTimeout(-1); if (!debugOn) window.close(); programs = null;}function substituteCommand(cmd){ var prog = path(cmd); var firstToken = prog.substr(0,prog.indexOf(" ")); switch (firstToken.toUpperCase()) { case 'FILECOPY': prog = ("CMD /C " + prog.replace(/FILECOPY/gi,'copy')); break; case 'DIRCOPY': prog = ("CMD /C " + prog.replace(/DIRCOPY/gi,'xcopy') + "/I /E /Y"); break; case 'RENAME': prog = ("CMD /C " + prog.replace(/RENAME/gi,'ren')); break; } return prog; }How can I solve this problem?Thanks in advance! Edited September 19, 2005 by kelsenellenelvian Link to comment Share on other sites More sharing options...
g-alex Posted September 16, 2005 Share Posted September 16, 2005 (edited) When you include files in folder $OEM$\$1 means that the files will copied to the systemdrive during the installation of windows.So in the case you have the folder $OEM$\$1\install\WPI\... in your unattended disc the folder install (incl. subdirs) will be copied to the systemdrive so the correct path for the applications is %systemdrive%\install....-or- if you dont want the files to be copied in the systemdrive you can have the install folder in the root dir of the disc so the correct path is %cdrom%\install\... Edited September 16, 2005 by g-alex Link to comment Share on other sites More sharing options...
ArjanDotOrg Posted September 16, 2005 Author Share Posted September 16, 2005 When you include files in folder $OEM$\$1 means that the files will copied to the systemdrive during the installation of windows.So in the case you have the folder $OEM$\$1\install\WPI\... in your unattended disc the folder install (incl. subdirs) will be copied to the systemdrive so the correct path for the applications is %systemdrive%\install....No, I don't have the folder with software in the $1... folder. It's on the CD in a folder called INSTALL, so in my case: V:\INSTALL\. These are not copied to the systemdrive, because they are not in a special folder. In my Configuration the programs are linked to: %CDROM%\INSTALL\, but it seems to use the %CDROM% not as V:\, but as V:\$OEM$\$1\install\WPI\, therefor it can't find the programs.It's rather difficult to explain, but I hope this is clear now.Regards,Arjan Link to comment Share on other sites More sharing options...
jondercik Posted September 16, 2005 Share Posted September 16, 2005 It is using %CDROM% as V:\$OEM$\$1\install\WPI because you are telling it to in this line:set wpipath=%cdrom%\$OEM$\$1\install\WPI Link to comment Share on other sites More sharing options...
ArjanDotOrg Posted September 16, 2005 Author Share Posted September 16, 2005 It is using %CDROM% as V:\$OEM$\$1\install\WPI because you are telling it to in this line:set wpipath=%cdrom%\$OEM$\$1\install\WPI<{POST_SNAPBACK}>Strange, because the string %CDROM% is not redefined if I am correct.How can I make it work? Link to comment Share on other sites More sharing options...
jondercik Posted September 16, 2005 Share Posted September 16, 2005 True, but you never really use %CDROM%. Link to comment Share on other sites More sharing options...
ArjanDotOrg Posted September 16, 2005 Author Share Posted September 16, 2005 Yes, but how do I make it work? That's all I want actually...I use %CDROM% in all my 300+ programlinks, and it always worked fine, until v4.3.5... So there must be something I can do to correct this? Link to comment Share on other sites More sharing options...
ArjanDotOrg Posted September 19, 2005 Author Share Posted September 19, 2005 (edited) Does anybody know what I have to do to fix this?It seems that I'm not the only one having problems with the %CDROM%-variable: http://www.msfn.org/board/index.php?showtopic=56138 Edited September 19, 2005 by ArjanDotOrg Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted September 19, 2005 Share Posted September 19, 2005 (edited) You have:REM Determine the WPI startup path. REM if wpi should run off the cd the replace %~dp0 with %cdrom%.set wpipath=%cdrom%\$OEM$\$1\install\WPIThat is why it is looking at %cdrom%\$OEM$\$1\install\WPIYou need:REM Determine the WPI startup path. REM if wpi should run off the cd the replace %~dp0 with %cdrom%.set wpipath=%cdrom%\INSTALL Edited September 19, 2005 by kelsenellenelvian Link to comment Share on other sites More sharing options...
ArjanDotOrg Posted September 20, 2005 Author Share Posted September 20, 2005 (edited) You have:REM Determine the WPI startup path. REM if wpi should run off the cd the replace %~dp0 with %cdrom%.set wpipath=%cdrom%\$OEM$\$1\install\WPIThat is why it is looking at %cdrom%\$OEM$\$1\install\WPIYou need:REM Determine the WPI startup path. REM if wpi should run off the cd the replace %~dp0 with %cdrom%.set wpipath=%cdrom%\INSTALL<{POST_SNAPBACK}>That doesn't seem to work. Now I get the error:Windows cannot find the file E:\\INSTALL\Backup\Syncback_Setup.exeStrange, because my CDROM driveletter is correctly found and displayed in the DOS-window as K:.The location of the file is:K:\INSTALL\Backup\Syncback_Setup.exeIn WPI, I filled this after Command 1:%cdrom%\INSTALL\backup\SyncBack_Setup\SyncBack_Setup.exe /VERYSILENTThe commandline from the CONFIG.JS is:cmd1[pn]=['%cdrom%\\INSTALL\\backup\\SyncBack_Setup\\SyncBack_Setup.exe /VERYSILENT']What is going wrong here...? Edited September 20, 2005 by ArjanDotOrg Link to comment Share on other sites More sharing options...
ArjanDotOrg Posted September 21, 2005 Author Share Posted September 21, 2005 Anybody? Link to comment Share on other sites More sharing options...
g-alex Posted September 21, 2005 Share Posted September 21, 2005 If the error message says exactly Windows cannot find the file E:\\INSTALL\Backup\Syncback_Setup.exepropably the correct path iscmd1[pn]=['%cdrom%\INSTALL\\backup\\SyncBack_Setup\\SyncBack_Setup.exe /VERYSILENT']because maybe %cdrom% returns E:\ and not E: Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted September 21, 2005 Share Posted September 21, 2005 Can you post the config file for us? Link to comment Share on other sites More sharing options...
ArjanDotOrg Posted September 22, 2005 Author Share Posted September 22, 2005 It's a big file, so I zipped it...config.zip Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted September 22, 2005 Share Posted September 22, 2005 It all looks good here (Figgin huge file m8).How many cd drives do you have? Why is there a drive k? CMD Shows the right drive? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now