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-11-10 18:18
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Online Help] Problem of Undefined Variable View 2,808 Replies 19
Floor 16 Posted 2006-12-19 02:00 ·  中国 广东 电信
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Just two suggestions regarding the code in your top post:
1. Add a variable delay statement;
2. If the %tmp% path contains spaces, it should be enclosed in quotes.
If you want to assign the return value of findstr to a variable, please post the content of your CheckV.TXT.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 17 Posted 2006-12-19 02:04 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
20-year member
UID 62249
Status Offline
Originally posted by redtek at 2006-12-19 01:56:
Another method:


@echo off && set "access=NO"
for /f %%i in ('findstr /i "ACCESS" %temp%\CheckV.txt') do set access=%%i
echo %access%

pause


...



Indeed ingenious. The method of assigning values first is worthy of promotion.
Floor 18 Posted 2006-12-19 02:05 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
20-year member
UID 62249
Status Offline
Originally posted by namejm at 2006-12-19 02:00:
  Two suggestions for the code in the top post:
  1、Add variable delay statements;
  2、If the %tmp% path contains spaces, it should be enclosed in quotes.

  If you want to assign the return value of findstr to a variable..


Thanks for the moderator's standardization. I'll modify it right away.
Floor 19 Posted 2006-12-19 02:08 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
20-year member
UID 63486
From 河北廊坊
Status Offline
Brother redtek is much taller than me!
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 20 Posted 2006-12-19 02:17 ·  中国 北京 朝阳区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
20-year member
UID 63324
Gender Male
Status Offline
Brother ccwan is too modest~ :)
I just didn't follow the thinking of Brother HUNRYBECKY's code in the first floor, and wasn't disturbed by the "original idea", so I used another method~ :)
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Forum Jump: