Advertisement
Combreal

createTestFileThenDestroy.vbs

Feb 7th, 2021
1,684
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CreateAFile()
  2. DiscardScript()
  3.  
  4. Function CreateAFile
  5.    Dim fso, MyFile
  6.    Set fso = CreateObject("Scripting.FileSystemObject")
  7.    Set MyFile = fso.CreateTextFile("C:\Temp\spooler\dummy.txt", True)
  8.    MyFile.WriteLine("This is a test.")
  9.    MyFile.Close
  10. End Function
  11.  
  12. Function DiscardScript()
  13.     Set objFSO = CreateObject("Scripting.FileSystemObject")
  14.     strScript = Wscript.ScriptFullName
  15.     objFSO.DeleteFile(strScript)
  16. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement