Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > Script Hanging?
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 21st May 22:31
michael harris \(mvp\)
External User
 
Posts: 1
Default Script Hanging?



Windows NT/Windows 2000 Privilege Strings
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/windows_nt_windows_2000_privilege_strings.asp

--
Michael Harris
Microsoft.MVP.Scripting
  Reply With Quote


  sponsored links


2 1st June 16:13
geir klemetsen
External User
 
Posts: 1
Default Script Hanging?



"Martin" <xbo61@dial.pipex.com> skrev i melding
news:079501c3630f$90d7b1e0$a601280a@phx.gbl...


****** Script begins here ********

A similar thing happends to me. don't know why, but it seems that under
certain cir***stances the script just stops running. In my example, my
script was trying to delete some files, and create a logg for those files
(if any) that failed to be deleted. Well, instead of waste my time
explaining the script problem, i rather just paste it into here:

' Delete all files in folder "TestFolder"
' While it deletes Files in the folder, it Write to a log-file
' the date and time. After that, the log-file get some more lines at the end
' listing up files that was successfully deleted, and those one
' that couldn't be deleted.

Dim EachFileToDelete
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
Set Test_FolderObj = FileSystemObject.getFolder("G:\TestFolder")
Set ParentFolderToThisFile =
FileSystemObject.getFile(WScript.ScriptFullName).P arentFolder
Set FilesCollectionToBeDeleted = Test_FolderObj.files

' Create a text-stream file, the log-file.
Set logg = FileSystemObject.OpenTextFile(ParentFolderToThisFi le.path &
"\Logfile.log", 8, True)

MuSub
' cal the sub-procedure

Sub MuSub()
On Error Resume Next
If FilesCollectionToBeDeleted.count > 0 Then ' Antall filer > 0.
logg.writeLine Date & VbTab & Time & VbTab & "Number of sucessed file
deletes: " & FilesCollectionToBeDeleted.count
Else
logg.writeLine Date & VbTab & Time & VbTab & "No files to delete"
End If
err.clear
For each EachFileToDelete in FilesCollectionToBeDeleted
FileSystemObject.deleteFile(EachFileToDelete)
MsgBox "Test: Te code runs so far"
' Error. That message never comes up.
If err.number <> 0 Then ' File couldn't be deleted for some reason.
'MsgBox "Was not alowed to delete te file named " & EachFileToDelete.name
logg.writeLine " The following file wasn't deleted: " &
EachFileToDelete.name
Else
'MsgBox "File deleted " & EachFileToDelete.name
logg.writeLine " -- " & EachFileToDelete.name
End If
err.clear
Next
End Sub
***** End script ********

Of couse, my announcement of my own problem will probably not help you, but
now we have a common type of problem. It has to be an error in windows
scripting host, if i'm not blinded to see my own errors, but i couldn't find
anyone. Hope there is a solution.
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666