如何使用批处理文件安装文件夹中所有.exe? [英] How to install all .exe in a folder using a batch file?

查看:332
本文介绍了如何使用批处理文件安装文件夹中所有.exe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图制定如下算法:

有关在当前文件夹中的所有文件(包含脚本文件夹)这样做:
安装文件逐一

  CLS
SETLOCAL disableDelayedExpansion如果%PROCESSOR_ARCHITECTURE%== 86套拱= 86
如果%PROCESSOR_ARCHITECTURE%== AMD64设置拱= 64在(一个* .exe)做/ R%〜DP0%% M(
    设置expath = %%米
    设置exfile = %%〜纳米    expath ::执行.exe文件

回声。
回声完成!
回声。
暂停
GOTO:EOF回声%exfile%


解决方案

这一点批​​处理文件开始在批处理文件作为单独进程的目录中的每个.exe文件。批量处理,直到启动的应用程序自行终止启动一个可执行文件后停止。

 关闭@echo
SETLOCAL DisableDelayedExpansion
为%%我在(%〜DP0 * .EXE),做(
    启动运行%%〜NI/等待%%我

ENDLOCAL

有关的常用命令的细节,打开命令提示符窗口并运行有以下命令行得到显示每个命令的帮助:


  • 为/?

  • 启动/?

I am trying to develop the following algorithm:

For all files in the current folder (folder containing the script) do: install the files one by one

cls
setlocal disableDelayedExpansion

if %PROCESSOR_ARCHITECTURE%==x86 set arch=x86
if %PROCESSOR_ARCHITECTURE%==AMD64 set arch=x64

for /r "%~dp0" %%m in ("*.exe") do (
    set expath=%%m
    set exfile=%%~nm

    expath :: execute the .exe files
)
echo.
echo Done! 
echo.
pause
goto :eof

echo %exfile%

解决方案

This little batch file starts each .exe file in directory of the batch file as separate process. Batch processing is halted after starting an executable until the started application terminated itself.

@echo off
setlocal DisableDelayedExpansion
for %%I in ("%~dp0*.exe") do (
    start "Running %%~nI" /wait "%%I"
)
endlocal

For the details on the used commands, open a command prompt window and run there the following command lines to get displayed the help for each command:

  • for /?
  • start /?

这篇关于如何使用批处理文件安装文件夹中所有.exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆