WotC Posted April 5, 2006 Share Posted April 5, 2006 Hi!Sorry if this was covered already, but the search didn't work for me. Here's my problem: i'm searching for cdrom drives using the common: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:\whatever.ico set cdrom=%%i:\This worked pretty fine - till i got a card reader. Now i get an error box all the time windows searches for the cdrom drive :-(. is there any known method to circumvent this annoying popup?Error-Message-Title: Windows - No DiskMessage-Text: There is no disk in the drive. Please insert a disk into drive.Cancel / Try again / ContinueAny hints are welcome... Link to comment Share on other sites More sharing options...
gunsmokingman Posted April 5, 2006 Share Posted April 5, 2006 Try a VBS script This script will check for all CD or DVD drives if there a disk in the drive then it produce a message box to confirm a disk in the drive. If there is no disk in the drive another message box is produced that say the drive is empty.Dim Drv, Fso, StrDrv Set Fso = CreateObject("Scripting.FileSystemObject") Set Drv = Fso.Drives For Each StrDrv In Drv If StrDrv.DriveType = 4 Then If StrDrv.IsReady = True Then MsgBox "This CD or DVD drive has a disk in it : " & StrDrv.DriveLetter, 0 + 32,"Disk In Drive" Else MsgBox "This CD or DVD drive has no disk in it : " & StrDrv.DriveLetter, 0 + 32,"Empty Drive" End If End If NextThis one will check for a specific file on any CD or DVD drive, when the check file is found it will produce a message box that say This is a XP CD then it will quit the script.Change this color in the script to suit your needs.If Fso.FileExists(StrDrv.DriveLetter & ":\win51ip.SP2") Then Dim Drv, Fso, StrDrv Set Fso = CreateObject("Scripting.FileSystemObject") Set Drv = Fso.Drives For Each StrDrv In Drv If StrDrv.DriveType = 4 Then If StrDrv.IsReady = True Then If Fso.FileExists(StrDrv.DriveLetter & ":\win51ip.SP2") Then MsgBox "This is a XP CD : " & StrDrv.DriveLetter, 0 + 32,"Confirm XP CD" Exit For Else MsgBox "This is not a XP CD : " & StrDrv.DriveLetter, 0 + 32,"Missing XP CD" End If End If End If Next Link to comment Share on other sites More sharing options...
MHz Posted April 6, 2006 Share Posted April 6, 2006 This worked pretty fine - till i got a card reader. Now i get an error box all the time windows searches for the cdrom drive :-(. is there any known method to circumvent this annoying popup?Error-Message-Title: Windows - No DiskMessage-Text: There is no disk in the drive. Please insert a disk into drive.Cancel / Try again / ContinueAny hints are welcome...With the little info given, here is my assumption...Seems like Windows Setup is possibly recognizing you Card Reader as a CDRom, which steals the letter used by the Windows Setup CD. Or it is disrupting the drivers of the CDRom which in effect leaves Windows Setup lost as the CD is not seen anymore. Adding the drivers for your Card Reader during textmode setup through the use of $OEM$ method may help, else perhaps you may need to leave the Card Reader disconnected during Windows Setup. Link to comment Share on other sites More sharing options...
muiz Posted April 6, 2006 Share Posted April 6, 2006 (edited) @gunsmokingmanit produce a message box to confirm a disk in the driveBut i dont want to click butons during setup , is there no other way?@MHzperhaps you may need to leave the Card Reader disconnected during Windows Setup.This is what im doing , and thats the best solution till now. Edited April 6, 2006 by muiz Link to comment Share on other sites More sharing options...
MHz Posted April 6, 2006 Share Posted April 6, 2006 it produce a message box to confirm a disk in the driveBut i dont want to click butons during setup , is there no other way?What do you refering to, muiz ? Link to comment Share on other sites More sharing options...
muiz Posted April 6, 2006 Share Posted April 6, 2006 read all the posts , you will see Link to comment Share on other sites More sharing options...
MHz Posted April 6, 2006 Share Posted April 6, 2006 read all the posts , you will see OK, you experience exactly the same issue.Thanks for alerting me. Link to comment Share on other sites More sharing options...
gunsmokingman Posted April 6, 2006 Share Posted April 6, 2006 Here the same script with out the message boxes, you will have to edit the file it checks for to suit your needs.Dim Drv, Fso, StrDrv Set Fso = CreateObject("Scripting.FileSystemObject") Set Drv = Fso.Drives For Each StrDrv In Drv If StrDrv.DriveType = 4 Then If StrDrv.IsReady = True Then If Fso.FileExists(StrDrv.DriveLetter & ":\win51ip.SP2") Then '''' PLACE_SCRIPT_HERE_THAT_YOU_NEED_BELOW_HERE Exit For End If End If End If NextThis was a template nothing more but then I assume most people would know that.muiz Posted Today, 03:18 AM @gunsmokingmanQUOTEit produce a message box to confirm a disk in the driveBut i dont want to click butons during setup , is there no other way?@MHzQUOTEperhaps you may need to leave the Card Reader disconnected during Windows Setup.This is what im doing , and thats the best solution till now. Link to comment Share on other sites More sharing options...
nateklomp Posted April 6, 2006 Share Posted April 6, 2006 I've had the same problem with Zip100 Drives, I'll try your script out.Thanks! Link to comment Share on other sites More sharing options...
muiz Posted April 6, 2006 Share Posted April 6, 2006 @MHzNo problem @gunsmokingmanTHX for your replyBut how and at wich point do i use your script? Link to comment Share on other sites More sharing options...
gunsmokingman Posted April 6, 2006 Share Posted April 6, 2006 The script will detect only CD or DVD drives I was only giving a alternative to thisfor %%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:\whatever.ico set cdrom=%%i:\Since the vbs script will only detect CD or DVD drives it should avoid the push button problem with the card reader, as to how he was using the above or when he was using it I do not know. If you post what you have and are trying to do, I will try and help you fix the problem. Link to comment Share on other sites More sharing options...
WotC Posted April 6, 2006 Author Share Posted April 6, 2006 (edited) @MHz: Sorry for the little info given. I was to busy. What i am doing is installing applications using WPI. whenever an application was installed i call a *.cmd file where start menu adjustments are made ar files like *.inis are copied to the %programfiles%\APP_whatever path. therefore i need to check where my install DVD is (e.g. which drive letter it has). i could do this just once at the beginning (did this originally) but then i though maybe i want to install additional programs later on, thats why i splitted my "one-file-cleanup" into several files.The windows setup cd is NOT lost - just this annoying popups (yes, because windows is so stupid and thinks i got a new cdrom drive...). i think adding drivers is not of any help because windows recognizes it (USB device, if i put in a card i can access it immediately). so disconnecting the reader is the only way obviously (or go back to my "single-file-cleanup" - **** - i hate this :-(.but thanks for your advice...@gunsmokingman&muiz:But i dont want to click buttons during setup , is there no other way? @gunsmokingman: i'll check your script, thanks - just one question (if you are faster anserweing it than i am trying it :-)):If Fso.FileExists(StrDrv.DriveLetter & ":\win51ip.SP2") Then '''' PLACE_SCRIPT_HERE_THAT_YOU_NEED_BELOW_HERE Exit Fori can put my xcopy blablabla.... here? with or without cmd /c ?THANKSedit: hmm, using the script and adding a "whatever.cmd" to be called doesnt do anything at all?! what am i doing wrong? Edited April 6, 2006 by WotC Link to comment Share on other sites More sharing options...
gunsmokingman Posted April 6, 2006 Share Posted April 6, 2006 @MHz: Sorry for the little info given. I was to busy. What i am doing is installing applications using WPI. whenever an application was installed i call a *.cmd file where start menu adjustments are made ar files like *.inis are copied to the %programfiles%\APP_whatever path. therefore i need to check where my install DVD is (e.g. which drive letter it has). i could do this just once at the beginning (did this originally) but then i though maybe i want to install additional programs later on, thats why i splitted my "one-file-cleanup" into several files.The windows setup cd is NOT lost - just this annoying popups (yes, because windows is so stupid and thinks i got a new cdrom drive...). i think adding drivers is not of any help because windows recognizes it (USB device, if i put in a card i can access it immediately). so disconnecting the reader is the only way obviously (or go back to my "single-file-cleanup" - **** - i hate this :-(.but thanks for your advice...@gunsmokingman&muiz:But i dont want to click buttons during setup , is there no other way? @gunsmokingman: i'll check your script, thanks - just one question (if you are faster anserweing it than i am trying it :-)):If Fso.FileExists(StrDrv.DriveLetter & ":\win51ip.SP2") Then '''' PLACE_SCRIPT_HERE_THAT_YOU_NEED_BELOW_HERE Exit Fori can put my xcopy blablabla.... here? with or without cmd /c ?THANKSedit: hmm, using the script and adding a "whatever.cmd" to be called doesnt do anything at all?! what am i doing wrong?You would need to make a new Object Here a re-edit script for you, this script will run only if a XP CD in the drive is XP SP2Saves this as THE_NAME_YOU_WANT.vbsI have added a new object to this it called Act, this script assumes the batch file is in the same location as the vbs script. If you have a full path to the Batch it will still work EG : H:\Folder\YOUR_CMD_FILE_NAME.cmd would work where PLACE_CMD_NAME_HEREDim Act, Drv, Fso, StrDrv Set Act = CreateObject("Wscript.Shell") Set Fso = CreateObject("Scripting.FileSystemObject") Set Drv = Fso.Drives For Each StrDrv In Drv If StrDrv.DriveType = 4 Then If StrDrv.IsReady = True Then If Fso.FileExists(StrDrv.DriveLetter & ":\win51ip.SP2") Then '''' PLACE_SCRIPT_HERE_THAT_YOU_NEED_BELOW_HERE Act.Run("PLACE_CMD_NAME_HERE"),1,True Exit For End If End If End If NextThis is a demo VBS using %Comspec% and doing a action, this will only run if a XP CD is in the drive and must be SP2.Save As THE_NAME_YOU_WANT.vbsDim Act, Drv, Fso, StrDrv Set Act = CreateObject("Wscript.Shell") Set Fso = CreateObject("Scripting.FileSystemObject") Set Drv = Fso.Drives For Each StrDrv In Drv If StrDrv.DriveType = 4 Then If StrDrv.IsReady = True Then If Fso.FileExists(StrDrv.DriveLetter & ":\win51ip.SP2") Then '''' PLACE_SCRIPT_HERE_THAT_YOU_NEED_BELOW_HERE Act.Run("%Comspec% /C @Echo Off && CLS && Mode 55,5 " &_ "&& Color 3f && Echo. && Echo %ComputerName% && set /p = %UserName% Press Key To Close"),1,True Exit For End If End If End If NextYou can change the check file name if you like to suit your needs Change this color text to suit your needs, this is the files it checks for on a CD or DVD drive.If Fso.FileExists(StrDrv.DriveLetter & ":\win51ip.SP2") Then Link to comment Share on other sites More sharing options...
WotC Posted April 7, 2006 Author Share Posted April 7, 2006 hey hey hey... getting closer - thanks. one more question:If StrDrv.DriveType = 4 Thenthis checks only "real" cdrom drives, doesn't it? how can i change that to include fixed drives, too? i want to "override" the cdrom path with a harddrive path whenever a certain file is present. using that "trick" i don't need to burn a dvd every time im installing my system and nevertheless have the latest software installed. i would do two subsequent for loops for that purpose (because on my install dvd the files im'm checking for are located within e.g. xxx\yyy and on a fixed drive the path would be \unattended\xxx\yyy). would that work? Link to comment Share on other sites More sharing options...
gunsmokingman Posted April 7, 2006 Share Posted April 7, 2006 (edited) I have added another loop for the harddrive, just fill in the path that you need.Dim Act, Drv, Fso, StrDrv Set Act = CreateObject("Wscript.Shell") Set Fso = CreateObject("Scripting.FileSystemObject") Set Drv = Fso.Drives For Each StrDrv In Drv If StrDrv.DriveType = 4 Then If StrDrv.IsReady = True Then If Fso.FileExists(StrDrv.DriveLetter & ":\win51ip.SP2") Then '''' PLACE_SCRIPT_HERE_THAT_YOU_NEED_BELOW_HERE Act.Run("%Comspec% /C @Echo Off && CLS && Mode 55,5 " &_ "&& Color 3f && Echo. && Echo %ComputerName% && set /p = %UserName% Press Key To Close"),1,True Exit For End If End If End If Next '''' CHECK FOR HARDDRIVE BELOW HERE ADD CORRECT PATH FOR FILE EXISTS For Each StrDrv In Drv If StrDrv.DriveType = 2 Then If Fso.FileExists(StrDrv.DriveLetter & ":\win51ip.SP2") Then '''' PLACE_SCRIPT_HERE_THAT_YOU_NEED_BELOW_HERE Act.Run("%Comspec% /C @Echo Off && CLS && Mode 55,5 " &_ "&& Color 3f && Echo. && Echo %ComputerName% && set /p = %UserName% Press Key To Close"),1,True Exit For End If End If NextIn the above you could also check for a folder exists alsoEG If Fso.FolderExists(StrDrv.DriveLetter & ":\FOLDER_NAME_HERE") Then Edited April 7, 2006 by gunsmokingman 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