假设D:驱动器中有一些文件夹:
D:\Air
D:\Abonden
D:\All
D:\Whatever
Run Code Online (Sandbox Code Playgroud)
我想删除所有以“A”开头的文件夹(包括所有子文件夹和文件)。我试过这个命令:
rmdir D:\A* /s /q
Run Code Online (Sandbox Code Playgroud)
不过我收到一个错误:(
文件名、目录名或卷标语法不正确。
该del命令适用于*,但我也需要删除文件夹。
有没有办法通过rmdir命令来实现?
我希望这个 vbs 代码能在远程机器上执行 oShell.run 方法。情况似乎并非如此,但此脚本执行时没有显示错误。
on error resume next
dim oShell, strComputer, intProcessID
strComputer = InputBox("IP or Host Name:", "DELETER - serdaruzun@outlook.com")
set oShell = WScript.CreateObject("Wscript.shell") & strComputer
oShell.run "cmd.exe /C rd \\%PC%\Users\1*.* /s /q", null, null, intProcessID
oShell.run "cmd.exe /C rd \\%PC%\Users\2*.* /s /q", null, null, intProcessID
oShell.run "cmd.exe /C rd \\%PC%\Users\3*.* /s /q", null, null, intProcessID
set oShell = nothing
Run Code Online (Sandbox Code Playgroud)
在远程计算机上执行这些命令的正确方法是什么?