所以,这就是我想要做的。我们正在推出一个基本的计时解决方案,让员工通过Liquid Office表格进出。为简化起见,我想自动创建快捷方式。我已经设法传递机器的IP,现在我需要将机器的名称传递到URL的第一部分。
可以这样做吗?我需要将“MACHINENAME”替换为实际的机器名称,并将其变为CompName。
'This script will grab the local active netowork adapter IP, host name, and and creates the time keeping shortcut, using the machines IP address.
'This script will take the local machine name and ammed it to the URL for the cash registers.
dim NIC1, Nic, StrIP, CompName
Set NIC1 = GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")
For Each Nic in NIC1
if Nic.IPEnabled then
StrIP = Nic.IPAddress(i)
Set WshNetwork = WScript.CreateObject("WScript.Network")
CompName= WshNetwork.Computername
Set oWS = WScript.CreateObject("WScript.Shell")
sLinkFile = "C:\Users\public\desktop\Clock in & Out.LNK"
Set oLink = oWS.CreateShortcut(sLinkFile)
oLink.TargetPath = "http://MACHINENAME:8080/lfserver/timecard?ip_address=" &StrIP
oLink.Description = "Clock in or out"
oLink.IconLocation = "%SystemRoot%\system32\SHELL32.dll, 111"
oLink.Save
wscript.quit
end if
next
答案 0 :(得分:0)
这就是你所追求的。将计算机名称添加到http路径?
oLink.TargetPath = "http://" & CompName & ":8080/lfserver/timecard?ip_address=" & StrIP