I want to make a script that deletes the folder and all the files in it. The script i am using is:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFolders = objWMIService.ExecQuery _
("Select * from Win32_Directory where Name = 'c:\\Documents and Settings\arehman\Desktop\test'")
For Each objFolder in colFolders
errResults = objFolder.Delete
Next
when i run the bat file with the above script a screen flashes on the monitor and nothing else happens. I also restarted the services. Same problem.
Someone please tell me where did i go wrong.
Thanks
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFolders = objWMIService.ExecQuery _
("Select * from Win32_Directory where Name = 'c:\\Documents and Settings\arehman\Desktop\test'")
For Each objFolder in colFolders
errResults = objFolder.Delete
Next
when i run the bat file with the above script a screen flashes on the monitor and nothing else happens. I also restarted the services. Same problem.
Someone please tell me where did i go wrong.
Thanks