Posts

Showing posts with the label vbscript

Checking VBScript for syntax error

Checking VBScript for syntax error I have a simple VBScript that copies a few files and calls a custom executable from the copied files on the system to set up a scheduled task. I am not well versed in VBScript and getting an error during compilation. It says "Expected end of statement". Here is my script. PLease help me get rid of that compilation error. Set objFso = CreateObject("Scripting.FileSystemObject") Set wshshell = CreateObject("WScript.Shell") Const HKEY_CURRENT_USER = &H80000001 Const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." ScriptPath = objfso.GetParentFolderName(WScript.ScriptFullName) WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%") Set objRegistry = GetObject("winmgmts:" & strComputer & "rootdefault:StdRegProv") Set XMLDOM = CreateObject("Microsoft.XMLDOM") XMLDOM.Async = False logfile = WinDir & "CDFLogsJoinDom.log" If WScript.Arguments.Named.E...

Trouble with basic VBScript that writes on a text file

Trouble with basic VBScript that writes on a text file I've copied an old VBS code from here, but it seems to be not working. I know nothing of VBS so I'm lost here. It seems to be very simple, it opens a text file, changes the values according to what was written before (it just "flips a bit"), removes the old file then writes the new one. It seems to be having issues with closing the file it created, and it never creates It's giving an error on Line 42, with the code 800A01A8, "Object Required: '' ". Const ForAppending = 8 Const ForReading = 1 Dim outPutFile Dim objFSO, objFile, objOutFile, strLine dim sleepLine1, sleepLine2, doNothingLine1, doNothingLine2 sleepLine1 = "powercfg -SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 1" sleepLine2 = "powercfg -SETDCVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6...