- Offizieller Beitrag
Hallo!
Ja es ist soweit! Es ist weihnachten Und aus diesem Grund habe ich für euch (naja.. eigentlich für mich^^) 2 Funktionen geschrieben! Einmal _GetVolumeID und einmal _SetVolumeID
Für _GetvolumeID brauch man keine extra programme (auser comspec halt^^) aber für _SetVolumeID brauch man leider Volumeid.exe (Im Dateianhang in der ZIP)
ACHTUNG! Die VolumeID zu ändern kann gefährlich sein, also bitte die finger davon lassen wenn man sich nicht 100% sicher ist was man machts bzw was die Volume ID überhaupt ist!
Ausserdem muss der PC (wider leider) nach dem Setzen der ID auf NTFS neugestartet werden!
Naja "lange" rede kurzer sinn.. hier ist das skript und die dazugehörigen dateien
Spoiler anzeigen
MsgBox(0,"VolumeID from D: without -",StringReplace(_GetVolumeID("D:"),"-",""))
[/autoit] [autoit][/autoit] [autoit]_SetVolumeID("C:",_GetVolumeID("C:"))
If @error Then Exit MsgBox(16,"","Error: Impossible to set the VolumeID!")
MsgBox(0,"","VolumeID succes set!")
;===============================================================================
;
; Function Name: _GetVolumeID
; Description:: Receives the Volume ID of the given Volume
; Parameter(s): $sHD: The Volume path (e.g. C:)
; Requirement(s): -
; Return Value(s): Volume ID on succes
; Return 0 and @error = 1 on faild
; Author: GtaSpider
;
;===============================================================================
Func _GetVolumeID($sHD = "C:")
Local $xVolid = DriveGetSerial($sHD)
IF @error Then Return SetError(1,0,0)
$xVolid = Hex($xVolid,
Return StringLeft($xVolid, 4) & "-" & StringRight($xVolid, 4)
EndFunc ;==>_GetVolumeID
;===============================================================================
;
; WARNING!!! Save you volume ID bevor you will change it, cause many programms need this ID (e.g. ICQ for pw's) WARNING!!!
;
; Function Name: _SetVolumeID
; Description:: Set the Volume ID of the given Volume
; Parameter(s): $sHD: The Volume path (e.g. C:)
; $iID: The Volume ID to set (e.g. 1234-1234 or 12341234)
; Requirement(s): Volumeid.exe (in ZIP)
; Return Value(s): Return 1 on succes
; Return 0 and @error = 1 on faild
; Author: GtaSpider
;
; Note: new NTFS volume ids will not appear in directory listings until after the next reboot.
;
;===============================================================================
Func _SetVolumeID($sHD,$iID)
Local $pid
If Not StringInStr($iID,"-") Then $iID = StringLeft($iID,4)&"-"&StringRight($iID,4)
$pid = Run("Volumeid.exe "&$sHD&" "&$iID,"",@SW_HIDE,6)
While ProcessExists($pid)
Sleep(50)
WEnd
If StringInStr(StdoutRead($pid),"xxxx-xxxx") Then Return SetError(1,0,0)
Return 1
EndFunc
Mfg Spider
Edit: lol.. VolumeID ist weitaus einfacher auszulesen, habe das UDF mal geupdatet