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-03 10:49
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] LXMXN, please take a look at this BAT View 1,039 Replies 2
Original Poster Posted 2007-02-03 09:54 ·  中国 陕西 汉中 电信
初级用户
Credits 136
Posts 49
Joined 2007-01-04 08:28
19-year member
UID 75413
Gender Male
Status Offline
I read brother LXMXN's BAT for cleaning up Tencent ads and tried writing one myself.
It still won't work, and I don't know what's wrong with the code below. Please kindly give me some advice!

@echo off
setlocal enabledelayedexpansion
set /p path_=Please enter QQ's installation directory:
if %path_%=="" set path_="D:\Program Files\Tencent\AD"
for /f %%a in ('dir /ba-d "!path_!\*.gif" "!path_!\*.swf"') do(
set name=%%~nxa & echo %name%>>name.txt
)
Floor 2 Posted 2007-02-10 10:33 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline

  Re beeny:

  " if %path_%=="" " here it's better to write it like this: " if "%path_%"=="" ". Also, there are two errors inside the parentheses of the for command. In " dir /ba-d ", these two parameters should be written separately: " dir /b /a-d ". Also, the variable inside the for parentheses doesn't need delayed expansion; you can just use %path_% directly.
 
  After that, following " set name= ", since delayed expansion is enabled, you should use " echo !name! ".

  Try modifying it according to these suggestions and see if it works.
Floor 3 Posted 2007-02-11 09:56 ·  中国 天津 东丽区 电信
初级用户
Credits 42
Posts 20
Joined 2007-02-02 04:25
19-year member
UID 78384
Gender Male
Status Offline
After reading it, I felt ashamed:
For many years I've only been reading (breaking?); at most I just write a BAT to help myself run some programs (stand?).
The OP got into real combat so quickly, impressive!
Even more impressive is brother lxmxn: doing even small good things!
Forum Jump: