我正在尝试在R中使用以下cmd函数
rmdir /q /s myDir
我尝试过:
system("rmdir /q /s myDir")
但返回错误:
rmdir: failed to remove '/q': No such file or directory
rmdir: failed to remove '/s': No such file or directory
rmdir: failed to remove 'public_html/croecon.contentio.biz': Directory not empty
我应如何使用斜杠选项,例如/ q?
答案 0 :(得分:1)
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set objEvents = objWMIService.ExecNotificationQuery("SELECT * FROM Win32_ProcessStartTrace")
Do
Set objReceivedEvent = objEvents.NextEvent
Set colItems = objWMIService.ExecQuery("Select * From Win32_Process where ProcessID=" & objReceivedEvent.ProcessID)
For Each objItem in colItems
wscript.echo objItem.name & " " & objItem.ProcessID & " " & objItem.CommandLine
Next
Loop
然后在命令提示符下键入
cscript //nologo C:\folder\MonitorProcessCreation.vbs
这将监视运行命令时的开始情况。