4

SCCM 2012 R2、サーバー 2012 サーバー、および Windows 7 クライアントを使用しています。学生のマシンは通常、Win7-64 です。

Eclipse をインストールするスクリプトを作成しました。基本的には、ディレクトリを作成してファイルをコピーします (Eclipse にはインストーラーがなく、32 ビット ソフトウェアです)。私のスクリプトでは、学生にとってより良いものにするために、デスクトップと [スタート] メニューにショートカットを配置したいと考えています。コードは次のとおりです。

REM Put icon on desktop
copy "Eclipse Mars (64).lnk" "C:\Users\Public\Desktop"
rename "C:\Users\Public\Desktop\Eclipse Mars (64).lnk" "C:\Users\Public\Desktop\Eclipse Mars.lnk"

ただし、リンクがクライアント デスクトップに表示されると、「C:\Program Files (x86)\Eclipse\eclipse.exe」の正しいターゲットが「C:\Program Files\Eclipse\eclipse.exe」に変更されるため、動作します ([開始] と同じ)。

ショートカットの内容を間違った Program Files ディレクトリに変更するのは何ですか?

最後に、この例では Eclipse について言及していますが、これは 64 ビット マシンにスクリプト化された 32 ビット ショートカットで発生します。

4

2 に答える 2

0

メイン バッチ ファイルから呼び出すことができる単純な VBS スクリプトを使用して、実際の Windows ショートカットを作成できます。

メイン バッチ ファイル:

REM Put icon on desktop
call "Create Shortcut.vbs" "C:\Users\Public\Desktop\Eclipse Mars (64).lnk" "C:\Program Files (x86)\eclipse-mars\eclipse.exe" "C:\Program Files (x86)\eclipse-mars"

VBS "ショートカットの作成.vbs":

' Check the number of parameters
If 3 <> WScript.Arguments.Count Then
    WScript.Echo "Please call this file using the following parameters:"
    WScript.Echo
    WScript.Echo "   LINK PATH   - Absolute path where the shortcut file will be created"
    WScript.Echo "   TARGET_PATH - Absolute path of the target program"
    WScript.Echo "   WORKING_DIR - Working directory used by this shortcut"
    WScript.Quit(1)
End If

strLinkPath   = WScript.Arguments(0)
strTargetPath = WScript.Arguments(1)
strWorkingDir = WScript.Arguments(2)

set oShell = WScript.CreateObject("WScript.Shell")

set oShellLink = oShell.CreateShortcut(strLinkPath)
oShellLink.TargetPath       = sTargetPath
oShellLink.WorkingDirectory = strWorkingDir
oShellLink.WindowStyle      = 1
oShellLink.Description      = ""
oShellLink.IconLocation     = strTargetPath
oShellLink.Save
于 2017-10-05T19:03:23.840 に答える
0

私は少し調査を行いました。これを試してみてください:

ren "Eclipsce Mars (64).lnk" eclm.tmp
copy "eclm.tmp" "C:\Users\Public\Desktop"
ren "C:\Users\Public\Desktop\eclm.tmp" "C:\Users\Public\Desktop\Eclipse Mars.lnk"
ren eclm.tmp "Eclipsce Mars (64).lnk"

私がやったこと:

  1. 元の名前.lnkをに変更eclm.tmp
  2. コピーeclm.tmpDesktop
  3. Desktop\eclm.tmpに改名Eclipse Mars.lnk
  4. 元の名前.lnkを通常に戻します。

これにより、ファイルの内容 を変更するWindows の傾向が回避されます。.lnk

これが機能する場合は、コメントと投票カウンターでお知らせください。
〜CSS

于 2016-10-27T21:10:27.143 に答える