从当前目录批量运行exe [英] Run exe from current directory in batch

查看:106
本文介绍了从当前目录批量运行exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试从批处理文件所在的目录中运行2个* .exe文件.命令:

I'm trying to run 2 *.exe files from whatever directory the batch file is located in. Commands:

@echo off
:A
cls
Echo programs
start %1myprogram.exe
start %1myprogram1.exe
exit

当我仅通过双击打开批处理文件时,此方法非常理想,但是当我以管理员身份运行批处理文件时,此方法不起作用.我需要执行此操作,因为这两个exe必须具有管理员权限.我怀疑会发生此错误,因为它像运行SYSTEM32文件夹一样运行批处理文件.这是正确的吗?

This works perfect when I open my batch file simply by double clicking it, but it doesn't work when I run the batch file as administrator. I need to do this as the two exe's have to have administrator privileges. I suspect this error occurs because it runs the batch file as if it were in the SYSTEM32 folder. Is this correct?

感谢您的帮助!埃里克

推荐答案

尽管答案在注释中,但应作为实际答案,以便从未答复"列表中删除该问题.

Although the answer is in the comments, it should be as an actual answer so that this question is removed from the "unanswered" list.

@echo off
:A
cls
echo programs
cd %~dp0
start %1myprogram.exe
start %1myprogram1.exe
exit

这篇关于从当前目录批量运行exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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