网上有用vbs实现的,似乎是通过修改注册表完成的。
回头研究研究下看看。- On Error Resume Next: b8 G+ u( t5 d; I0 o1 q& q
- ‚孤烟编写于2007.8.18 QQ:632745 zjrencn @ bbs.txwm.com
- serverpath="//webserver/temp$/" ‚要映射的网络路径+ p8 s# f0 F& X4 ]- R1 H
- mydisk="j:/" ‚要映射的盘符2 g9 i% T4 A, p8 X% B+ C$ [
- mydiskname="音乐盒" ‚要映射的名字
- if right(serverpath,1)="/" then0 e1 B4 ^7 C) i' _+ f
- serverpath=left(serverpath,len(serverpath)-1); O( i1 q- \2 l, [9 c7 ^# C
- end if1 e8 j. }* M. g9 @$ s6 N; }
- if right(mydisk,1)="/" then
- mydisk=left(mydisk,len(mydisk)-1)
- end if
- set wshshell=wscript.createObject("wscript.shell")- T+ J1 G' ~* y& u" K1 c4 m' R
- wshshell.run ("%comspec% /c regsvr32 /s scrrun.dll"),0,True2 ?0 i C! C# D0 C: Z$ L
- regspath=replace(serverpath,"/","#")
- wshshell.Regwrite "HKCU/Software/Microsoft/Windows/CurrentVersion/Explorer/MountPoints2/"& regspath&"/_LabelFromReg",mydiskname,"REG_SZ" 5 D7 M4 G! E* B5 ^& n
- Set WSHNetwork = WScript.CreateObject("WScript.Network")
- WSHNetwork.RemoveNetworkDrive mydisk
- WSHNetwork.MapNetworkDrive mydisk, serverpath: g5 R: H) ?2 |. Q6 E
- wshshell.run "explorer "&mydisk
复制代码
|