Jump to content

Recommended Posts

Posted

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
)
)


Posted

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

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...