进行静默安装程序以将文件从文件复制到C:\ Program Files \ ...,然后在开始菜单中进行快捷方式

问题描述

我不太确定这是问这个问题的正确地方。 但是我想制作一个脚本来复制驱动器上已安装软件的结构。 问题是,我想在该文件夹中有一个文件夹,其中包含在您的PC上安装软件时包含的所有文件,然后我想将所有文件从该文件夹复制到C:\ Program Files ...,然后为开始菜单添加快捷方式。

这是蝙蝠代码

xcopy "%~dp0Struktura" "c:\" /s /i /y
cscript.exe ".\CreateLTspiceXVIIShortcut.vbs"

这是vbs代码

Set WshShell = WScript.CreateObject("WScript.Shell")
Set lnk = WshShell.CreateShortcut("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\LTspiceXVII.lnk")
lnk.TargetPath = "C:\Program Files\LTC\LTspiceXVII\start_pc.exe"
lnk.Arguments = ""
lnk.Description = "LTspiceXVII"
lnk.WorkingDirectory = "%ProgramFiles%\Program Files\LTC\LTspiceXVII"
lnk.IconLocation = "%ProgramFiles%\LTC\LTspiceXVII\\start_pc.exe,0"
lnk.WindowStyle = "1"
lnk.Save

它将所有文件复制到正确的位置,但是它在cmd中显示了所有进程,我想使其保持静音,因此它不会在屏幕上显示任何内容。 之后,它不会在开始菜单中创建快捷方式,因此应该做到这一点。 我该怎么办?

Picture of all files I have

文件中,“ Struktura”的意思是“结构”。

This is the content of the structure file

我希望有人能理解我的意思。

非常感谢您的帮助! :)

解决方法

您可以在VBScript中制作所有内容,例如:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "xcopy ""%~dp0Struktura"" ""c:\"" /s /i /y",True
Set lnk = WshShell.CreateShortcut("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\LTspiceXVII.lnk")
With lnk
  .TargetPath = "C:\Program Files\LTC\LTspiceXVII\start_pc.exe"
  .Arguments = ""
  .Description = "LTspiceXVII"
  .WorkingDirectory = "%ProgramFiles%\Program Files\LTC\LTspiceXVII"
  .IconLocation = "%ProgramFiles%\LTC\LTspiceXVII\start_pc.exe,0"
  .WindowStyle = "1"
  .Save
End With

然后不需要批处理文件。您可以将其另存为.vbs文件并执行。它将没有任何窗口。

,

我不是Windows用户,但我直接看到的是