从可执行文件设置变量 [英] Setting a variable from an executable

查看:141
本文介绍了从可执行文件设置变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个具有两个参数的批处理文件中运行一个可执行文件:

I am running an executable in a batch file with two parameters;

cmd / kexecutableparam1param2

这将返回一个我要启动的字符串。我不知道如何在一个变量中设置这个返回值,并随后在IE中启动它。

This returns a string that I want to launch. I can't figure out how to set this return in a variable and subsequently launch it in IE.

任何想法?

推荐答案

您可以使用以下语法将可执行文件的输出捕获到变量中:

You can use the following syntax to capture the output of your executable into a variable:

FOR /F "tokens=*" %%i in ('%~dp0YOUR_APP.exe') do SET TOOLOUTPUT=%%i

Source

值到IE,像这样:

START "YOUR_WINDOW_NAME" /MAX /D"C:\Program Files\Internet Explorer\" iexplore %TOOLOUTPUT%

我认为确定网址的应用程序代码太复杂直接在批处理文件中再现,或者对可执行文件的源已丢失。如果不是,我个人倾向于在批处理文件本身中看到逻辑。

I take it that the application code that determines the url is too complicated to be reproduced in a batch file directly, or the source to the executable has been lost. If not I personally would prefer to have the logic visible in the batch file itself.

这篇关于从可执行文件设置变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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