|
sunlight
初级用户
 
积分 160
发帖 15
注册 2004-7-12
状态 离线
|
『楼 主』:
怎样把.EXE执行的结果送到批处理文件中?
使用 LLM 解释/回答一下
我想把.EXE执行的结果以一个字符串的形式送到批处理文件中,作为批处理中的一个变量,怎样实现?谢谢!
I want to send the result of executing .EXE as a string into a batch file and use it as a variable in the batch. How to achieve this? Thanks!
|
|
2004-11-22 00:00 |
|
|
Climbing
铂金会员
       网络独行侠
积分 6962
发帖 2753
注册 2003-4-16 来自 河北保定
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
你如果能把问题描述的更清楚一些,我想你的问题好解决的多。
If you can describe the problem more clearly, I think your problem will be much easier to solve.
|

偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
|
|
2004-11-22 00:00 |
|
|
sunlight
初级用户
 
积分 160
发帖 15
注册 2004-7-12
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
我现在想把EXE运行的结果不是以0或1的形式返回,而是返回一个字符串,把这个字符串赋给批处理文件中的一个变量,与批处理文件中原有的字符串进行比较,看输出的字符是否正确,怎样实现?
I now want to make the result of EXE running not return in the form of 0 or 1, but return a string, assign this string to a variable in the batch file, and compare it with the existing string in the batch file to see if the output characters are correct. How to implement it?
|
|
2004-11-22 00:00 |
|
|
windrate
初级用户
 
积分 113
发帖 4
注册 2004-11-22
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
对啊!我也想知道!请教!!
Yeah! I also want to know! Please teach! !
|
|
2004-11-22 00:00 |
|
|
Climbing
铂金会员
       网络独行侠
积分 6962
发帖 2753
注册 2003-4-16 来自 河北保定
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
EXE文件返回什么结果不是由你的主观愿望决定的,而是由exe文件本向决定的。exe文件返回的结果你可以用errorlevel环境变量来判断,当然,你的批处理可以根据errorlevel的值来判断exe文件执行时遇到了什么情况并显示出来。
The result returned by an EXE file is not determined by your subjective wishes, but by the EXE file itself. You can use the errorlevel environment variable to judge the result returned by the EXE file. Of course, your batch processing can judge what situation the EXE file encountered during execution according to the value of errorlevel and display it.
|

偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
|
|
2004-11-22 00:00 |
|
|
windrate
初级用户
 
积分 113
发帖 4
注册 2004-11-22
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
对了!能否换一种解决方案!就是在exe中将所需要的字符串写入到一个文件中,然后由批处理读取那个文件的内容赋值给变量再进行比较呢?
By the way! Can we change to another solution! That is, write the required string into a file in the exe, and then the batch script reads the content of that file and assigns it to a variable for comparison?
|
|
2004-11-22 00:00 |
|
|
hunter_han
初级用户
 
积分 104
发帖 1
注册 2004-10-28
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
可以用setinfo.exe实现
It can be achieved with setinfo.exe
|
|
2004-11-26 00:00 |
|
|
bush
银牌会员
    
积分 2165
发帖 730
注册 2004-4-21
状态 离线
|
|
2004-11-29 00:00 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
Re windrate: 这当然是可以的,前提是你可以修改这个程序,无论是修改源码,还是反汇编。 另外,将程序结果输出到系统环境变量中,似乎是一个老话题,已经出现了很多的解决方案,但大体上都是先生成一个类似于set var=string的字符串,然后将它作为命令执行。 在中等限制条件下(不允许命令扩展和第三方程序)可以使用debug生成字符串前缀文件,然后将程序输出追加重定向至这个文件,最后把他作为批处理程序运行即可。 在最高限制条件下(不允许命令扩展和外部命令)可以使用预先编辑好的字符串前缀文件。当然还可以使用其它特定命令(可能是内部命令或外部命令)的特定输出,这就比较复杂了。
Re windrate: This is certainly possible, provided that you can modify this program, whether it's modifying the source code or disassembling it. Additionally, outputting the program results to the system environment variables seems to be an old topic, and many solutions have emerged, but generally, it's to first generate a string similar to "set var=string" and then execute it as a command. Under moderate restrictive conditions (command extensions and third-party programs not allowed), you can use debug to generate a string prefix file, then append the program output to this file, and finally run it as a batch program. Under the highest restrictive conditions (command extensions and external commands not allowed), you can use a pre-edited string prefix file. Of course, you can also use the specific output of other specific commands (which may be internal or external commands), which is more complicated.
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2004-12-4 00:00 |
|
|
zybird
中级用户
  
积分 240
发帖 53
注册 2005-1-21
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
是你自己写的exe吗?如果是的话,可以看看这个,里面就讲了这种方法:http://www.doshome.com/bbs/dispbbs.asp?boardID=5&ID=7288
Is this EXE you wrote yourself? If so, you can take a look at this, which explains this method: http://www.doshome.com/bbs/dispbbs.asp?boardID=5&ID=7288
|
|
2005-1-21 00:00 |
|
|
笨的可以
初级用户
 
积分 114
发帖 7
注册 2005-1-21
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
3楼的对,重定向功能,就是:你的EXE程序>结果文件名称即可
What the 3rd said is right. The redirection function means: your EXE program > result file name.
|
|
2005-1-21 00:00 |
|
|
kavenlee72
中级用户
  
积分 369
发帖 87
注册 2003-9-14
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
如果有返回码(errorlevel),就好办了。请看:if errorlevel 1 set el=you are rightif errorlevel 2 set el=you are wrongif %el%==you are right goto XXXif %el%==you are wrongt goto YYY
If there is a return code (errorlevel), it's easy. Please see:
if errorlevel 1 set el=you are right
if errorlevel 2 set el=you are wrong
if %el%==you are right goto XXX
if %el%==you are wrong goto YYY
|
|
2005-2-21 00:00 |
|
|
gmy
版主
        操作系统爱好者
积分 1113
发帖 392
注册 2002-11-11
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
用到以下关键命令:> 重定向到文件strings 或 inifile 读取字符串。具体方法自己看帮助吧。
The key commands used are: > redirect to file, strings or inifile read strings. For the specific method, please refer to the help yourself.
|

DOS之家 http://doshome.com 站长 葛明阳 |
|
2005-2-21 00:00 |
|
|
DOSforever
金牌会员
     
积分 4639
发帖 2239
注册 2005-1-30
状态 离线
|
|
2005-2-22 00:00 |
|