Help - Search - Members - Calendar
Full Version: CD-ROM DRIVE LETTER
MSFN Forums > Unattended Windows Discussion & Support > Application Installs

   


Google Internet Forums Unattended CD/DVD Guide
zedocon
To anyone who can help me:


I have made a program that will automatically integrate Windows XP with SP2.
It works grate as long as the cd-rom is drive D:. If I put the cd-rom in
any other cd-rom drive, (such E:, F:, or G:) it does not work, unless I change
the cd-rom drive letter in the program manually. What I would like to know is
what command do I use for my program to recognize any cd-rom drive letter.

example: XCOPY (ANY CD-ROM DRIVE LETTER)\file.ext C:\Directory


Thank you, Zedocon
gunsmokingman
This is Js Script that
1:\ Checks for the CD or DVD drive and this file i386\winnt32.exe
2:\ It then checks for this folder %SystemDrive%\XPCD
If it not there then it makes that folder
3:\ It uses the copy dialog to copy the CD DVD to %SystemDrive%\XPCD
4:\ If the CD DVD does not have a XP source in it it start a loop that will wait
for approx 1 minute, for the source if it reaches the default time out it quits.
Sava As CopyXP.js
QUOTE
CODE
var moveOrRenameTrue=8, YesAll=16, DislpayBar=256, noConfirmDirCreate=512
var oShell = new ActiveXObject("Shell.Application");
var Act = new ActiveXObject("Wscript.Shell");
var Fso = new ActiveXObject("Scripting.FileSystemObject");
var XPCD = Act.ExpandEnvironmentStrings("%SystemDrive%\\XPCD");
var Cnt = 10, Dnt = 0
function CopyXpToUaWork(objFolder) {
   /* DEFAULT TIMEOUT EXIT */
  if (Cnt == "0") {Act.Popup("Default Wait Time Has Ended" +'\n'+
  "Preparing To Exit The Script", 7,"No XP Source", 0 + 32 + 4096), WScript.Quit();}
   /* TO PREVENT COPY IF TWO CD OR DVD DRIVES FOR XP SOURCE EXISTS */
  if (Dnt == "99") {WScript.Quit();}
   var Cd_DVD = "\\i386\\winnt32.exe"
   var FOF_CREATEPROGRESSDLG = '&H0&', WbemReturn = 0x10, WbemFoward = 0x20;  
   var Drv , objFolder = oShell.NameSpace(XPCD);
   var ObjWmi = GetObject("winmgmts:\\\\.\\root\\CIMV2");
   var colItems = ObjWmi.ExecQuery("SELECT * FROM Win32_CDROMDrive", "WQL",WbemReturn | WbemFoward);
   /* START THE LOOP FOR CD OR DVD THEN COPY */
   var enumItems = new Enumerator(colItems);
   for (; !enumItems.atEnd(); enumItems.moveNext()) { var objItem = enumItems.item();
    Drv = objItem.Drive + Cd_DVD;
  /* ADDS A NEW EMPTY XPCD FOLDER */
    if (Fso.FolderExists(XPCD) == false) { Fso.CreateFolder(XPCD);}
    if (Fso.FileExists(Drv))
    {Act.Popup("Confirm XP Source, Preparing To Start Copy",7,"Confirm XP Source", 0 + 32 + 4096)
     Drv = objItem.Drive, objFolder.CopyHere(Drv + "\\..\\*", FOF_CREATEPROGRESSDLG+DislpayBar);
     Dnt = 99;}
    else {Cnt = Cnt - 1, Act.Popup("Missing The XP Source" + '\n' +
    "When This Get To Zero : " + Cnt +'\n'+ "This Will Then Close",9,"Missing XP Source", 0 + 32 + 4096)
    CopyXpToUaWork()};}}
/* <-- START THE SCRIPT --> */ CopyXpToUaWork()
AlBundy33
I you are running the command from your CD-Drive (e.g. during svcpack.inf) you can create a batch file with your command.
e.g if you want to do XCOPY (ANY CD-ROM DRIVE LETTER)\file.ext C:\Directory your Batch (e.g. cp.cmd) should contain the following line:
CODE
XCOPY %~d0\file.ext C:\Directory

%0 is the name of you script
%~d0 is the drive that the script contains
%~dp0 is the path to your script
%~dpnx0 or %~f0 is the foll path to your script (including filename and extension)
--> If you have a look at the FOR command you can see all available options.

Hope this helps.

Greetings.

Al
rajesh.kumar
you can use the following line in a cmd file and use the %cdrom% variable to access the cd drive. Here Appz.CD is an empty file which has to be present in the cd root to identify the drive letter where the cd is present. u can use ur own file anyway.

FOR %%i IN (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:\Appz.CD SET CDROM=%%i:




Google Internet Forums Unattended CD/DVD Guide

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.