Created
September 26, 2015 11:48
-
-
Save shayas/0845d35e6af2c0746230 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''''''''''''''''''''''''''' | |
' | |
' 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