تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
لمعرفة حرف ال Drive الخاص ب USB
#1
كاتب الموضوع : AhmedEssawy


كود :
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'FileName Reg.vbs
'Author Clanguuage
'Creation Date 05/04/2007
'Purpose To register the USB drive
' This script will retrieve the drive letter assigned to the USB
' it will then register the information in the registry.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colDrives = objFSO.Drives
'cycle through all the drives to find the newly assigned lettter of the USB
For Each objDrive in colDrives
if objDrive.VolumeName = "AOIDATA" then
strValue = objDrive.DriveLetter & ":\AOIDATA"
exit for
end if
Next

Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Tracker II\Path Names\General"
strValueName = "USBPath"

oReg.SetStringValue _
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

'Const HKEY_LOCAL_MACHINE = "USBPath"
'
'strComputer = "."
'
'Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
' strComputer & "\root\default:StdRegProv")
'
'strKeyPath = "\SOFTWARE\Tracker II\Path Names\General"
'oReg.CreateKey HKEY_LOCAL_MACHINE ,strKeyPath
}}}
تم الشكر بواسطة:



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم