0

VBScript を使用して、ユーザーのデスクトップへのショートカットを作成しようとしています。ただし、C:\Users\username\Desktop\My Scans.lnk ではなく C:\desktop\My Scans という間違ったディレクトリにショートカットを配置しようとしているため、コードに何かが欠けているようです。

Set oWS = WScript.CreateObject("WScript.Shell")
sLinkFile = (desktopPath & "\My Scans.LNK")
Set oLink = oWS.CreateShortcut(sLinkFile)
oLink.Save

私が見逃しているものはありますか?ご協力いただきありがとうございます

4

1 に答える 1

1

これは私にとってはうまくいくようです:

Set oWS = WScript.CreateObject("WScript.Shell")
' Get the %userprofile% in a variable, or else it won't be recognized
userProfile = oWS.ExpandEnvironmentStrings( "%userprofile%" )
sLinkFile = userProfile & "\desktop\My Scans.LNK"
Set oLink = oWS.CreateShortcut(sLinkFile)
oLink.Save
于 2012-10-29T22:02:02.643 に答える