中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 11:35
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS学习入门 & 精彩文章 (教学室) » Repost: Assign the DOS version information string to a variable
Printable Version  2,095 / 1
Floor1 MYS Posted 2003-04-09 00:00
元老会员 Posts 1,637 Credits 5,170 From 广东佛山
Quoted from a reply post on the NetEase community. I haven't tried it myself.

How to assign the version information string obtained by var to a variable

You can extract the variable from prompt; below is a general method:

You can create a batch file in the following form; the contents can be modified as needed.
::getvar.bat
@if == prompt set %2=%3
@if == goto end
@echo off
%comspec% /c %0 invoke %1 %2>tt.bat
call tt

:end

When running it, just add the environment variable name and the corresponding prompt variable value, for example:
getvar curver $v

The advantage of this method is that besides getting the DOS version, it can also get other variables provided by prompt. In addition, its temporary file can be created and deleted at runtime, thus allowing it to run as a standalone program.
Floor2 Wengier Posted 2003-04-10 00:00
系统支持 Posts 10,521 Credits 27,736
I think using STRINGS VER is still more convenient.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023