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-06-20 06:30
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to use P to delete $NtUninstallKB873339$ View 3,868 Replies 15
Original Poster Posted 2008-06-29 20:51 ·  中国 上海 杨浦区 电信
初级用户
Credits 102
Posts 48
Joined 2008-03-18 23:42
18-year member
UID 113352
Gender Male
Status Offline
How to use P to delete a large number of $NtUninstallKB873339$ $NtUninstallKB886185$ and other patch update files in the Windows directory??? I have tried $*$ but it didn't work

[ Last edited by guigui on 2008-6-29 at 09:04 PM ]
Floor 2 Posted 2008-06-30 03:26 ·  中国 广东 广州 白云区 电信
中级用户
★★
Credits 233
Posts 117
Joined 2007-11-28 02:38
18-year member
UID 104005
Gender Male
Status Offline
cd /D %windir%
attrib -r -s -h c:$*$ /s /d
for /d %%d in (c:$*$) do rd "%%d" /s /q
Try this way
Floor 3 Posted 2008-07-01 21:54 ·  中国 上海 杨浦区 电信
初级用户
Credits 102
Posts 48
Joined 2008-03-18 23:42
18-year member
UID 113352
Gender Male
Status Offline
It doesn't work. It flashes and then disappears. Is there really no way???
Floor 4 Posted 2008-07-01 22:15 ·  中国 重庆 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Run it in the command line interpreter and paste the result here.
Floor 5 Posted 2008-07-01 22:18 ·  中国 广东 广州 电信
银牌会员
★★★
永远的菜鸟
Credits 1,335
Posts 574
Joined 2007-11-27 12:50
18-year member
UID 103929
Gender Male
From 广西
Status Offline
Paste the following code into the command prompt and run it to see. If there are no error messages, it means the deletion was successful.
for /d %a in ("%systemroot%\$*$") do @rd /s /q "%a"
Floor 6 Posted 2008-07-01 23:02 ·  中国 上海 虹口区 电信
初级用户
Credits 102
Posts 48
Joined 2008-03-18 23:42
18-year member
UID 113352
Gender Male
Status Offline
I followed the P processing done by the elder brother upstairs, but there were no error messages reported, and the files were all there. I directly copied and ran it in CMD.
Floor 7 Posted 2008-07-01 23:10 ·  中国 重庆 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
What about this?
for /f %a in ('dir /ad /b "%systemroot%\$*$"') do rd /s /q "%systemroot%\%a"
Floor 8 Posted 2008-07-02 01:17 ·  中国 江苏 常州 溧阳市 电信
银牌会员
★★★
Credits 2,404
Posts 946
Joined 2005-09-08 13:44
20-year member
UID 42345
Status Offline
What about dir /a-d /b + del?
简单!简单!再简单!
Floor 9 Posted 2008-07-02 10:24 ·  中国 上海 静安区 电信
初级用户
Credits 102
Posts 48
Joined 2008-03-18 23:42
18-year member
UID 113352
Gender Male
Status Offline
Brother HAT, it seems to be successful, but why does it work directly in CMD? When I copy the command to a.BAT and run it, it just flashes by and the file isn't deleted? I've tried it several times and it's like this.
Floor 10 Posted 2008-07-02 10:29 ·  中国 台湾 台北市 远传电信
初级用户
Credits 107
Posts 42
Joined 2007-09-03 16:43
18-year member
UID 96475
Gender Male
Status Offline
Originally posted by guigui at 2008-7-2 10:24 AM:
HAT大哥 It seems to be successful, but why does it work directly in CMD? When the command is copied into a .BAT and run, it just flashes by and the file isn't deleted? I've tried several times and it's like this.



bat %a should be changed to %%a
Floor 11 Posted 2008-07-02 10:31 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Learn to read help as soon as possible

Microsoft Windows XP
(C) Copyright 1985-2001 Microsoft Corp.

C:\Test>for /?
Runs a specified command for each file in a set of files.

FOR %variable IN (set) DO command

%variable Specifies a single letter replaceable parameter.
(set) Specifies a set of one or more files. Wildcards may be used.
command Specifies the command to carry out for each file.
command-parameters
Specifies parameters or switches for the specified command.

To use the FOR command in a batch program, specify %%variable instead
of %variable.
Variable names are case sensitive, so %i is different
from %I.
Floor 12 Posted 2008-07-02 10:32 ·  中国 上海 静安区 电信
初级用户
Credits 102
Posts 48
Joined 2008-03-18 23:42
18-year member
UID 113352
Gender Male
Status Offline
Floor 13 Posted 2008-07-04 10:18 ·  中国 上海 静安区 电信
初级用户
Credits 102
Posts 48
Joined 2008-03-18 23:42
18-year member
UID 113352
Gender Male
Status Offline
I'm still so stupid. I've been trying in the.bat and it just doesn't work. It always flashes by. Hey, it seems I still need to study more. Still, I need to trouble some big brother to write one for me?
Floor 14 Posted 2008-07-04 10:47 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
```
for /f %%a in ('dir /ad /b "%systemroot%\$*$"') do rd /s /q "%systemroot%\%%a"
```

Save the code as C:\test.bat
Start, Run, cmd, C:\test.bat
Paste the result here to have a look
Floor 15 Posted 2008-07-04 11:46 ·  中国 上海 静安区 电信
初级用户
Credits 102
Posts 48
Joined 2008-03-18 23:42
18-year member
UID 113352
Gender Male
Status Offline
It worked out. Haha. But at that time I wrote it exactly like that, the same command as Brother HAT, but why did it flash by? Then I newly created a test.bat and then copied the command in again and it worked. Oh my, what's the situation here?
Forum Jump: