Skip to content

Instantly share code, notes, and snippets.

@shayas
Created September 26, 2015 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shayas/0845d35e6af2c0746230 to your computer and use it in GitHub Desktop.
Save shayas/0845d35e6af2c0746230 to your computer and use it in GitHub Desktop.
'''''''''''''''''''''''''''
'
' Author : Shay Ashkenazi
'
' VBScript System Library
'
'''''''''''''''''''''''''''
' Run system command
Function Run(command)
Run = WScript.CreateObject("WScript.Shell").Run command
End Function
' Kill System process
Function KillProcess(process)
KillProcess = CreateObject("WScript.shell").Exec "taskkill /IM " & process
End Function
' Read file from file system
Function ReadFile(path)
Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile(path, 1)
raw = objFileToRead.ReadAll()
objFileToRead.Close
Set objFileToRead = Nothing
ReadFile = raw
End Function
' Write string to a file
Function WriteToFile(path, text)
Set objFileToWrite = CreateObject("Scripting.FileSystemObject").OpenTextFile(path, 2, true)
objFileToWrite.Write(text)
objFileToWrite.Close
Set objFileToWrite = Nothing
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment