【问题标题】:VBS File - Pass InputBox input to SLinkFile?VBS 文件 - 将 InputBox 输入传递给 SLinkFile?
【发布时间】:2014-05-15 13:51:48
【问题描述】:

所以,我真的没有 vbs 的经验,我知道的最多的是在 access 中编写非常基本的字符串。所以,在花了一个小时试图解决这个问题后,我来这里寻求帮助。

我要做的是编写一个 .vbs 脚本,提示用户输入本地机器的 IPAddress,然后将其修改为 oLink.TargetPath(在 = 之后)

到目前为止,我只有:

Dim IP_Address 
Ip_Address = Inputbox("Enter The Machine IP")

Set oWS = WScript.CreateObject("WScript.Shell")
sLinkFile = "C:\Dropbox\Personal\Latitude e6430 - Work\Desktop\timekeeping.LNK"
Set oLink = oWS.CreateShortcut(sLinkFile)
    oLink.TargetPath = "http://w-sch-fooddb:8675/lfserver/timecard?ip_address="
    oLink.Description = "Clock in or out"   
    oLink.IconLocation = "%SystemRoot%\system32\SHELL32.dll, 111"
oLink.Save

【问题讨论】:

    标签: vbscript shortcut


    【解决方案1】:

    字符串连接是通过 & 运算符完成的:

    >> Ip_Address = "1.2.3.4"
    >> TargetPath = "http://w-sch-fooddb:8675/lfserver/timecard?ip_address=" & Ip_Address
    >> WScript.Echo TargetPath
    >>
    http://w-sch-fooddb:8675/lfserver/timecard?ip_address=1.2.3.4
    >>
    

    【讨论】:

    • 谢谢。我试图把它放在引号内,而不是放在引号之外。你拯救了我的一天......