安装.bat文件

发布于 2024-10-16 00:21:59 字数 176 浏览 3 评论 0原文

我需要做的是制作一个 .bat 脚本,该脚本将从我的服务器中提取安装文件,并在工作站上启动它们以由工作站上的用户安装程序。这 1 个程序总共有 8 个安装,必须按顺序启动。

关于用于拉取安装文件的命令或如何使用 PS exec 进行安装有什么想法吗?我没有任何可做的,我所做的所有研究都以其他方式进行,然后制作了安装脚本。

What I need to do is make a .bat script that will pull the install files from my server and launch them on a workstation to install a program, by a user on the workstation. There are 8 installs total for this 1 program and they have to be launched in order.

Any ideas on commands used to pull install files or how to use PS exec to install? I don't have anything to go with, all the research I did took me in other ways then making an install script.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

网名女生简单气质 2024-10-23 00:21:59

实际上,我可以通过在 cmd 提示符下玩弄自己来解决这个问题。我尝试了一系列命令,但没有成功,然后我只尝试了由暂停分隔的文件路径,对于任何寻找简单脚本来启动 .exe 的人来说,它都有效:(引号是文件路径中是否有空格)
在 cmd 提示符或保存为 .bat 文件的记事本中

- "\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 01\setup.exe"

Pause

"\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 02\setup.exe”

暂停

“\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 03\setup.exe

”暂停

“\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 04\setup.exe”

暂停

I was actually able to figure it out on my own by playing around in cmd prompt. I tried a series of commands with no luck then I tried just the file paths separated by a pause and it worked so for anyone looking for a simple script to launch .exe's: (the quotations are if there are any spaces in the file path)
In cmd prompt or in notepad saved as a .bat file-

"\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 01\setup.exe"

Pause

"\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 02\setup.exe"

pause

"\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 03\setup.exe"

pause

"\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 04\setup.exe"

pause

东京女 2024-10-23 00:21:59

我建议使用START /WAIT命令。它将等待每个安装程序完成后再开始下一个安装,无需用户交互。在每次设置之间放置 PAUSE 将强制用户按 Enter 键 4 次。如果您想从服务器运行bat 文件并将bat 文件与安装程序一起保留在服务器上,我还建议您研究PUSHD。这样您就可以从服务器执行 bat 文件,将其指向连接到您想要的网络的任何计算机,然后运行它。

例如(使用开始/等待):

@echo off

:CHECKIFTHISBATISRUNONSERVER
REM Checks to see if this bat file has been run from a server or from a local computer

IF NOT EXIST "%~nx0" (pushd %~dp0% & set batchfilemode=server) ELSE (set batchfilemode=local computer)

REM the lines below will start each program and wait for it to finish before starting the next setup.

START "SETUP 1" /WAIT "\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 01\setup.exe"

START "SETUP 2" /WAIT "\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 02\setup.exe"

START "SETUP 3" /WAIT "\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 03\setup.exe"

START "SETUP 4" /WAIT "\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 04\setup.exe"

POPD

EXIT /B

I'd suggest using the START /WAIT command. It will wait for each setup program to finish before beginning the next install, without the need for user interaction. Putting a PAUSE in between each setup will force the user to press the enter key 4 times. I'd also suggest looking into PUSHD if you want to run the bat file from a server and keep the bat file on the server along with the install programs. This way you could execute the bat file from the server, point it at whichever computer connected to the network you want, and run it.

ex (using START /WAIT):

@echo off

:CHECKIFTHISBATISRUNONSERVER
REM Checks to see if this bat file has been run from a server or from a local computer

IF NOT EXIST "%~nx0" (pushd %~dp0% & set batchfilemode=server) ELSE (set batchfilemode=local computer)

REM the lines below will start each program and wait for it to finish before starting the next setup.

START "SETUP 1" /WAIT "\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 01\setup.exe"

START "SETUP 2" /WAIT "\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 02\setup.exe"

START "SETUP 3" /WAIT "\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 03\setup.exe"

START "SETUP 4" /WAIT "\\000.00.00.00\programs\Apps\ProgramsBASELINE\cd install 04\setup.exe"

POPD

EXIT /B
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文