cmd控制台输出到变量 [英] cmd console output to variable

查看:1015
本文介绍了cmd控制台输出到变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些工具可以直接输出一些数据到控制台输出。

I have some tool which is outputs some data directly to console output.

我想保存这个输出到某个变量,然后传递给别的地方...

I want to save this output to some variable and then pass it somewhere else...

可以吗?

示例:

rem this outputs String1 values from myfile.txt
GetString myfile.txt String1
rem I want this value for example in %p% variable, and then:
call MyApp %p%


推荐答案

尝试这个

for /f %%a in ('GetString myfile.txt') do call MyApp %%a

虽然我不太确定你对 String1 bit,如果这不正确,你能澄清吗?

Although I'm not really sure what you mean about the String1 bit, if this isn't right, can you clarify?

这篇关于cmd控制台输出到变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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