#26556 - 2002-08-06 03:44 PM
Re: Desktop Shortcuts
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
try this
code:
Break on
deldrive("h")
function DelDrive($letter) dim $d[6], $dp[6], $loop, $desktop
$desktop=readvalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Desktop") $desktop=expandenvironmentvars($desktop) $d=DriveProp("$letter") if $d[1]="network" use "$letter:" /d $dp=split($d[2],"\") $icon=dir("$desktop\shortcut to*.lnk") while not @error if instr($icon,$dp[2]) and instr($icon,$dp[3]) ? "got it" $icon del "$desktop\$icon" endif $icon=dir() loop endif
endfunction
function DriveProp($Drive) dim $fso, $Drives, $list, $param, $property $DriveType="unknown","removable","fixed","network","cd-rom","ram" $DrivePara="driveletter","drivetype","sharename","isready","filesystem","volumename","serialnumber" dim $temparray[6] $fso = createobject("scripting.filesystemobject") if $fso $D=$fso.getdrive("$Drive") for $param = 0 to ubound($DrivePara) $property=$DrivePara[$param] $ret=execute('$$temparray[$param]=$$d.$property') if $param=1 $temparray[$param]=$DriveType[$temparray[$param]] endif next $DriveProp=$temparray $fso="" endif exit @error endfunction
|
Top
|
|
|
|
#26564 - 2002-08-06 04:40 PM
Re: Desktop Shortcuts
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
it only deletes the shortcut if the servername and sharename are in the 'shortcut to'
Driveprop() is a UDF described in the UDF forum, and it's purpose is to return and array of values of the types described in the $DrivePara array
The Deldrive() function only will operate if it is passed a drive letter that it a network drive type (not a CD drive letter) it will only function if you give it a network drive to delete.
beyond that, just read the code line by line... it is just little steps
|
Top
|
|
|
|
#26568 - 2002-08-06 05:38 PM
Re: Desktop Shortcuts
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
$desktop=readvalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Desktop") del "$desktop\shortcut to net_share on 'fileserver' (T).lnk"
Click here for more detail [ 06. August 2002, 17:42: Message edited by: Radimus ]
|
Top
|
|
|
|
#26570 - 2002-08-06 06:05 PM
Re: Desktop Shortcuts
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 259 anonymous users online.
|
|
|