Board logo

标题: [文本处理] bat创建快捷方式的的问题 [打印本页]

作者: 一步莲华    时间: 2017-12-29 12:42     标题: bat创建快捷方式的的问题

set a=%~dp0vmware.exe -x
set b= %~dp0vmwarexuniji\centos.vmx
set c="%a%%b%"
echo 创建快捷方式
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersDesktop"")

& ""\VMware.lnk""):b.TargetPath="%c%":b.WorkingDirectory=""%~dp0\"":b.Save:close") >nul
echo.
pause


想给目标加一个参数  但是怎么改都会报错,求大神支招...感激不尽
作者: search_Sudoku    时间: 2017-12-29 14:54

回复 1# 一步莲华

保存为 VBS 文件
  1. Set fso = CreateObject("Scripting.FileSystemObject")
  2. GetTheParent = fso.GetParentFolderName(WScript.ScriptFullName)
  3. Set WshShell = WScript.CreateObject("WScript.Shell")
  4. AllUsersDesktop = WshShell.SpecialFolders("AllUsersDesktop")
  5. Set b = WshShell.CreateShortcut(AllUsersDesktop & "\VMware.lnk")
  6. b.TargetPath = "" & GetTheParent & "\vmware.exe"
  7. b.Arguments = "-x """ & GetTheParent & "\vmwarexuniji\centos.vmx"""
  8. b.WorkingDirectory = GetTheParent
  9. b.Save
  10. WScript.Quit
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2