![]() |
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-04 10:07 |
48,038 topics / 350,123 posts / today 0 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » Why can't this VBS program delete all icons on the desktop??? |
| Printable Version 2,501 / 17 |
| Floor1 stornager | Posted 2007-04-24 06:31 |
| 中级用户 Posts 131 Credits 328 | |
|
```vb
Function DeleteDesktopFiles() Dim files Set files=CreateObject(Script.FileSystemObject) file.DeleteFiles "C:\Documents and settings\some\desktop\*.* " End Function ![]() ![]() ![]() ``` |
|
| Floor2 lxmxn | Posted 2007-04-24 06:39 |
| 版主 Posts 4,938 Credits 11,386 | |
|
It seems that VBS does not support wildcards.
|
|
| Floor3 flyinspace | Posted 2007-04-24 06:43 |
| 银牌会员 Posts 517 Credits 1,206 | |
|
desktop
Are you using the English version? No way?? It seems it should be desktop? C:\Documents and settings\some\Desktop\ Another thing, I don't understand vbs... I won't give an opinion. |
|
| Floor4 jmz573515 | Posted 2007-04-24 08:33 |
| 银牌会员 Posts 464 Credits 1,212 | |
|
file.DeleteFiles doesn't seem to have...
|
|
| Floor5 balinger | Posted 2007-04-24 08:34 |
| 中级用户 Posts 115 Credits 356 | |
|
Dim fs, f, File, fc
Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFolder("C:\Documents and settings\some\desktop") Set fc = f.Files For Each File in fc File.Delete true Next [ Last edited by balinger on 2007-4-24 at 08:35 AM ] |
|
| Floor6 wudixin96 | Posted 2007-04-24 08:37 |
| 银牌会员 Posts 931 Credits 1,928 | |
Originally posted by stornager at 2007-4-24 06:31 AM: Should be scripting and deletefile And for Chinese systems, it should be Desktop. [ Last edited by wudixin96 on 2007-4-24 at 08:57 AM ] |
|
| Floor7 stornager | Posted 2007-04-24 11:17 |
| 中级用户 Posts 131 Credits 328 | |
|
Thanks to all the experts for your guidance
|
|
| Floor8 baomaboy | Posted 2007-04-24 11:29 |
| 银牌会员 Posts 554 Credits 1,513 | |
|
Don't argue whether it's "desktop" or "桌面". If it has been changed, it might be "D:\桌子".
[ Last edited by baomaboy on 2007-4-24 at 11:32 AM ] |
|
| Floor9 lxmxn | Posted 2007-04-24 12:21 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Which directory it is doesn't matter. What matters is that each keyword of the object and method is correct and there are no grammar errors.
|
|
| Floor10 dikex | Posted 2007-04-24 14:03 |
| 高级用户 Posts 366 Credits 788 | |
|
There are also icons in C:\Documents and Settings\All Users\desktop
|
|
| Floor11 kich | Posted 2007-04-25 11:12 |
| 中级用户 Posts 168 Credits 397 | |
| Floor12 nicesoft | Posted 2007-04-26 14:24 |
| 初级用户 Posts 47 Credits 98 | |
|
Comments from user "baomaboy" on floor 8: The code!!
|
|
| Floor13 lxmxn | Posted 2007-04-26 15:31 |
| 版主 Posts 4,938 Credits 11,386 | |
|
To baomaboy(6F):
Why doesn't this work for me? |
|
| Floor14 slore | Posted 2007-04-27 02:02 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
Originally posted by lxmxn at 2007-4-26 02:31: Set WShell=WScript.CreateObject("Wscript.Shell") msgbox WShell.SpecialFolders("DeskTop") Set WShell = Nothing The set a is wrong... That is no longer an object... For VBS with wsh... You can use wsh1. |
|
| Floor15 zhoushijay | Posted 2007-04-27 02:28 |
| 高级用户 Posts 375 Credits 845 | |
|
deletefile is not deletefiles
|
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |