pinout Posted January 2, 2005 Share Posted January 2, 2005 I wanted an alternative method for finding the drive letter of the Windows install CD, so rather than checking for a certain file on drives A-Z, wouldn't this work on 2K/XP ?Theres a value named "SourcePath" stored under "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"Works on 2K at least...Basically it'll query the SourcePath value and just to ensure that the correct disc is in the drive it'll look for the file "CDROM_NT.5" - that's the file for 2K, not sure what it is on XP - adjust it to whatever you want.@ECHO OFF@SET KEY=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion@SET TAB=<insert tab character here>FOR /F "tokens=3 delims=%TAB%" %%i IN ('REG.EXE QUERY "%KEY%" /v "SourcePath" ^| FINDSTR /I "SourcePath"') DO ( FOR /F "tokens=1 delims=\" %%j IN ("%%i") DO ( IF EXIST "%%j\CDROM_NT.5" @SET CDROM=%%j )) Link to comment Share on other sites More sharing options...
Martin Zugec Posted January 3, 2005 Share Posted January 3, 2005 As I posted somewhere else, I think the best way is to find cdrom drive with cd, that have specific name, inside... Using WMI or WMIC it is not hard and U can be sure it will work Link to comment Share on other sites More sharing options...
pinout Posted January 3, 2005 Author Share Posted January 3, 2005 What is WMI / WMIC? Link to comment Share on other sites More sharing options...
Martin Zugec Posted January 3, 2005 Share Posted January 3, 2005 WMI is the core system for managing windows... From HW, processes, services to exchange... WMIC is WMI Console - it is shipped with Windows XP and W2k3 Server. It allow access to WMI even for people who dont like programming. For example command (in cmd.exe) "wmic process get name" will list all processes."wmic process list brief" will show basic informations."wmic process list full" will show all available informations.Check it Using wmic. exe /? U can see all available aliases. There is possibility to directly access WMI schema and add aliases, so there is great capability. 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