|
beyoungse
中级用户
  
积分 253
发帖 112
注册 2005-12-20
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
Originally posted by wudixin96 at 2007-9-2 17:30:
Set objComputer = CreateObject("Shell.LocalMachine")
Wscript.Echo "Computer name: " & objComputer.MachineName
会提示 Computer name: XXX (还要点一下确定)
我不能实现 这行批处理所要的结果(NET USE D: \\SERVER\%COMPUTERNAME% %COMPUTERNAME% /USER:%COMPUTERNAME%),能不能帮我写一个VBS
Originally posted by wudixin96 at 2007-9-2 17:30:
Set objComputer = CreateObject("Shell.LocalMachine")
Wscript.Echo "Computer name: " & objComputer.MachineName
Will prompt "Computer name: XXX" (need to click OK again)
I can't achieve the result required by this batch command (NET USE D: \\SERVER\%COMPUTERNAME% %COMPUTERNAME% /USER:%COMPUTERNAME%). Can you help me write a VBS?
|
|
2007-9-2 17:44 |
|
|
beyoungse
中级用户
  
积分 253
发帖 112
注册 2005-12-20
状态 离线
|
『第 17 楼』:
使用 LLM 解释/回答一下
在windows 中文站得到如下代码(加上自己套) 不能正常运行
On error resume next
Set objNet = CreateObject("Wscript.Network")
strCompName = objnet.ComputerName
Set objNetwork = CreateObject("Wscript.Network")
strNewName = "data"
' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "d:","\\server\A"strCompName"$","A"strCompName"","A"strCompName""
' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewName
Got the following code from the Windows Chinese site (with my own wrapping), but it doesn't run properly.
On error resume next
Set objNet = CreateObject("Wscript.Network")
strCompName = objnet.ComputerName
Set objNetwork = CreateObject("Wscript.Network")
strNewName = "data"
' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "d:","\\server\A"strCompName"$","A"strCompName"","A"strCompName""
' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewName
|
|
2007-9-2 21:00 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
"d:","\\server\A"strCompName"$","A"strCompName"","A"strCompName""
你看看……
字符串相当混乱!
"d:","\\server\A"strCompName"$","A"strCompName"","A"strCompName""
Take a look...
The string is quite messy!
|
|
2007-9-2 21:02 |
|
|
beyoungse
中级用户
  
积分 253
发帖 112
注册 2005-12-20
状态 离线
|
『第 19 楼』:
使用 LLM 解释/回答一下
老大,帮帮我看看下面代码的第十三行
On error resume next
Set objNet = CreateObject("Wscript.Network")
strCompName = objnet.ComputerName
strNewName = "data"
strDriveLetter = "d"
' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "d:","\\server\A" & strCompName & "$","A" & strCompName, "A" & strCompName,
' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewName
|
|
2007-9-2 21:46 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 20 楼』:
使用 LLM 解释/回答一下
objNetwork.MapNetworkDrive "d:","\\server\A" & strCompName & "$","A" & strCompName, "A" & strCompName,
第3个参数好像不对吧?最后为什么还有,?
第13行……看来是最后一行。
如果你用"D"字符串看看还出错不?不的话应该对的。
objNetwork.MapNetworkDrive "d:","\\server\A" & strCompName & "$","A" & strCompName, "A" & strCompName,
The third parameter doesn't seem right? Why is there a comma at the end?
Line 13... It seems to be the last line.
If you use the "D" string to see if it still errors? If not, it should be correct.
|
|
2007-9-2 23:41 |
|
|
beyoungse
中级用户
  
积分 253
发帖 112
注册 2005-12-20
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
' #test.vbs
Set objNet = CreateObject("Wscript.Network")
strCompName = objnet.ComputerName
strNewName = "data"
strDriveLetter = "d"
' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "d:","\\server\A" & strCompName & "$","A" & strCompName, "A" & strCompName
' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewName
' #完

' #test.vbs
Set objNet = CreateObject("Wscript.Network")
strCompName = objnet.ComputerName
strNewName = "data"
strDriveLetter = "d"
' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "d:","\\server\A" & strCompName & "$","A" & strCompName, "A" & strCompName
' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewName
' #完

|
|
2007-9-3 10:52 |
|
|
wudixin96
银牌会员
    
积分 1928
发帖 931
注册 2007-1-6
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
object.MapNetworkDrive(strLocalName, strRemoteName, [bUpdateProfile], [strUser], [strPassword])
看清楚这行,如果想要用户名和密码,而不需要UpdateProfile的话,也要把位置给让出来的。
strLocalName, strRemoteName,, strUser, strPassword
中间有两逗号
object.MapNetworkDrive(strLocalName, strRemoteName, , , )
Please note this line. If you want to use the username and password without UpdateProfile, you also need to leave the position empty.
strLocalName, strRemoteName,, strUser, strPassword
There are two commas in the middle
|
|
2007-9-3 11:00 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 23 楼』:
使用 LLM 解释/回答一下
只设置strLocalName, strRemoteName就可以啦
Just set strLocalName and strRemoteName.
|
|
2007-9-3 11:12 |
|
|
beyoungse
中级用户
  
积分 253
发帖 112
注册 2005-12-20
状态 离线
|
|
2007-9-3 11:16 |
|
|
beyoungse
中级用户
  
积分 253
发帖 112
注册 2005-12-20
状态 离线
|
『第 25 楼』:
使用 LLM 解释/回答一下
是可以啦,谢谢 22F ,但是不能改变此盘的名称

It's okay, thank you 22F, but the name of this disk can't be changed

|
|
2007-9-3 11:24 |
|
|
wudixin96
银牌会员
    
积分 1928
发帖 931
注册 2007-1-6
状态 离线
|
『第 26 楼』:
使用 LLM 解释/回答一下
谢谢slore了,人老了,眼睛都不好使了
Last edited by wudixin96 on 2007-9-3 at 11:55 AM ]
Thanks to slore, people are getting old, and eyes are not working well
Last edited by wudixin96 on 2007-9-3 at 11:55 AM ]
|
|
2007-9-3 11:40 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 27 楼』:
使用 LLM 解释/回答一下
Originally posted by wudixin96 at 2007-9-3 11:40:
strDriveLetter
此变量从何而来??
他前面定义了……貌似是d
Originally posted by wudixin96 at 2007-9-3 11:40:
strDriveLetter
Where does this variable come from??
He defined it earlier... It seems to be d
|
|
2007-9-3 11:48 |
|
|
beyoungse
中级用户
  
积分 253
发帖 112
注册 2005-12-20
状态 离线
|
『第 28 楼』:
使用 LLM 解释/回答一下
问题解决
strDriveLetter = "d:"
Problem Solving
strDriveLetter = "d:"
|
|
2007-9-3 12:13 |
|
|
beyoungse
中级用户
  
积分 253
发帖 112
注册 2005-12-20
状态 离线
|
『第 29 楼』:
使用 LLM 解释/回答一下
#OK.VBS
On error resume next
Set objNet = CreateObject("Wscript.Network")
strCompName = objnet.ComputerName
strNewName = "data"
strDriveLetter = "d:"
' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "d:","\\server\A" & strCompName & "$",,"A" & strCompName, "A" & strCompName
' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewName
#OK.VBS
On error resume next
Set objNet = CreateObject("Wscript.Network")
strCompName = objnet.ComputerName
strNewName = "data"
strDriveLetter = "d:"
' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "d:","\\server\A" & strCompName & "$",,"A" & strCompName, "A" & strCompName
' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewName
|
|
2007-9-3 12:25 |
|