zedocon Posted November 9, 2006 Posted November 9, 2006 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 inany other cd-rom drive, (such E:, F:, or G:) it does not work, unless I changethe cd-rom drive letter in the program manually. What I would like to know iswhat command do I use for my program to recognize any cd-rom drive letter.example: XCOPY (ANY CD-ROM DRIVE LETTER)\file.ext C:\DirectoryThank you, Zedocon
gunsmokingman Posted November 9, 2006 Posted November 9, 2006 (edited) This is Js Script that 1:\ Checks for the CD or DVD drive and this file i386\winnt32.exe2:\ It then checks for this folder %SystemDrive%\XPCDIf it not there then it makes that folder3:\ It uses the copy dialog to copy the CD DVD to %SystemDrive%\XPCD4:\ 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.jsvar moveOrRenameTrue=8, YesAll=16, DislpayBar=256, noConfirmDirCreate=512var 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() Edited January 8, 2007 by gunsmokingman
AlBundy33 Posted November 12, 2006 Posted November 12, 2006 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: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 Posted November 13, 2006 Posted November 13, 2006 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:
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