DOS command in script not executing

  • n_davies
  • Born
  • Born
  • n_davies
  • Posts: 1

Post 3+ Months Ago

Hi everyone, new member and already have a question. So I'm hoping one of you guys can help me please?

I've put together a very basic script to read a line from a text file and then delete a folder on a server's share that uses the same name extracted from the text file, the script should then go to the next line in the text file and do the same. For some reason I can not get the DOS command used to remove a folder to work(in red). I get no errors. I've used this script in other guises before to perform tasks sucesfully so it must be something to do with the dos command. I've tried the command on a command line without any problems.

I've put a copy of the script below, it is very basic and I'm probably doing things a different/non efficient way, but I'm new to this and still learning!!!

ipFile = wscript.arguments(0)

set onet = createobject("wscript.network")
set ofs = createobject("scripting.filesystemobject")

Set oipFile = ofs.opentextfile(ipFile, 1, False)
if (Err.Number <> 0) then
wscript.echo "Cannot open " & ipFile
wscript.quit
end if

On Error Resume Next

while not oipFile.atEndOfStream
ip = oipFile.ReadLine()
wscript.echo vbCrLf & "Processing User " & ip & "..."
Set ObjWS = WScript.CreateObject("WScript.Shell")
wscript.echo "Deleting xxx folder ..."
ObjWS.Run "rmdir \\SERVER\user\" & ip & " /S /Q" , 0,"True"
wend

oipFile.close()

wscript.echo vbCrLf & "User folder removal is now complete."

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 19 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.