China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 07:15
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Ask DOS experts, come and take a look View 2,322 Replies 3
Original Poster Posted 2011-01-05 13:06 ·  中国 浙江 杭州 联通
新手上路
Credits 6
Posts 2
Joined 2011-01-05 00:32
15-year member
UID 180338
Gender Male
Status Offline
In DOS, if you want to create a folder with the name "WDCWD1600AAJS-00B4A0" based on the content in a txt document where that part is in the "Model" line, you can do the following steps:

First, you need to extract the model name from the txt file. Assuming the txt file is named "diskinfo.txt", you can use a batch script to do this. Here is a simple batch script example:

```batch
@echo off
for /f "tokens=2 delims=: " %%a in (diskinfo.txt) do (
if "%%a"=="Model" (
set model=%%b
md "!model!"
goto :end
)
)
:end
```

You can save the above code as a `.bat` file, put it in the same directory as the `diskinfo.txt` file, and then run it. This script will find the line with "Model" in the `diskinfo.txt` file, extract the model name, and create a folder with that name.

Please note that this is a basic example, and you may need to adjust it according to the actual situation.

[ Last edited by min2nan on 2011-1-5 at 19:50 ]
Floor 2 Posted 2011-01-05 15:54 ·  中国 安徽 滁州 电信
新手上路
Credits 4
Posts 2
Joined 2010-12-30 08:43
15-year member
UID 180052
Gender Male
Status Offline
Direct MD C:\WDCWD1600AAJS-00B4A0
Floor 3 Posted 2011-01-20 12:32 ·  中国 广东 中山 联通
新手上路
Credits 11
Posts 6
Joined 2010-09-24 15:12
15-year member
UID 174762
Gender Male
Status Offline
Not clear! Just started learning not long ago
Floor 4 Posted 2012-12-07 22:08 ·  中国 河南 移动
新手上路
Credits 12
Posts 5
Joined 2012-12-05 11:19
13-year member
UID 181054
Gender Male
Status Offline
echo 扬刀
Forum Jump: