Solved VBS Automation Script not working

Netgear / Dg834g
February 15, 2014 at 21:46:23
Specs: Windows XP, HexaCore AMD FX-6100, 1400 MHz (7 x 200) / 4gb DDR
Hi was wondering if anyone can help me with a script I found at http://www.makeuseof.com/tag/xx-way...

It appears to be a very old thread but I cannot seem to get it working I keep getting an error on Line 12 Character 15

I customised my script version as below, so if anyone can figure out what's wrong could you help please thanks <3:

<job>
<script language="VBScript">
Option Explicit
On Error Resume Next
Dim WshShell
Dim retVal
set WshShell=CreateObject("WScript.Shell")
WshShell.run "CCleaner.exe /AUTO"
WshShell.run "spybot.bat"
WshShell.run "Emsisoft.bat"
WshShell.run "Cleanmgr /sagerun:1"
WshShell.run “defrag.bat”
WScript.Quit 0
</script>
</job>

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


See More: VBS Automation Script not working

Report •


#1
February 26, 2014 at 11:04:29
Q1) Does "defrag.bat" exist?
Q2) In the working directory of the script?

How To Ask Questions The Smart Way


Report •

#2
February 28, 2014 at 02:56:35
Razor yes it does, in fact I have made a few changes since the post got it working now thanks :) it has evolved quite a lot this is what I have now below! I have stopped using the vbscript.

@echo off
setlocal enabledelayedexpansion
@For /F "tokens=1,2,3,4 delims=/ " %%A in ('Date /t') do @(
Set Days=%%A
Set Month=%%A
Set Day=%%B
Set Year=%%C
)

:: ###########################################################
> cleaning.tmp echo Running
set state="C:\state\status.txt"
if not exist %state% md C:\state\
:: http://www.makeuseof.com/tag/xx-way...
:: ###########################################################
if exist "C:\Program Files\Malwarebytes' Anti-Malware\mbam.exe" (set mbytes=11) else (set mbytes=10)
if exist "C:\Program Files\Malwarebytes' Anti-Malware\mbam.exe" (set mbaU="C:\Program Files\Malwarebytes' Anti-Malware\mbam.exe" /runupdate) else (set mbaU=echo none)
if exist "C:\Program Files\Malwarebytes' Anti-Malware\mbam.exe" (set mbaS="C:\Program Files\Malwarebytes' Anti-Malware\mbam.exe" /fullauto) else (set mbaS=echo none)
if exist "C:\Program Files\Defraggler\df.exe" (set def="C:\Program Files\Defraggler\df") else (set def="Defrag")
if exist "C:\Program Files\CCleaner\CCleaner.exe" (set cc=1) else (set cc=10)
if exist "C:\Program Files\CCleaner\CCleaner.exe" (set ccscf="C:\Program Files\CCleaner\CCleaner.exe" /AUTO) else (set ccscf=echo none)
if exist "C:\Program Files\CCleaner\CCleaner.exe" (set ccscr="C:\Program Files\CCleaner\CCleaner.exe" /REGISTRY /AUTO) else (set ccscr=echo none)
if exist "C:\Program Files\Spybot - Search & Destroy\SpybotSD.exe" (set spb=1) else (set spb=10)
if exist "C:\Program Files\Spybot - Search & Destroy\SpybotSD.exe" (set spybot1="C:\Program Files\Spybot - Search & Destroy\SpybotSD.exe" /autocheck /autofix /autoclose) else (set spybot1=echo none)
if exist "C:\Program Files\Emsisoft Anti-Malware\a2cmd.exe" (set a2c=1) else (set a2c=10)
if exist "C:\Program Files\Emsisoft Anti-Malware\a2cmd.exe" (set amalu="C:\Program Files\Emsisoft Anti-Malware\a2cmd.exe" /update) else (set amalu=echo none)
if exist "C:\Program Files\Emsisoft Anti-Malware\a2cmd.exe" (set amals="C:\Program Files\Emsisoft Anti-Malware\a2cmd.exe" /quick /quarantine="C:\Program Files\Emsisoft Anti-Malware\Quarantine" /delete) else (set amals=echo none)
if %mbytes%==1 echo Updating MalwareBytes &&%mbaU%

:: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
if %a2c%==10 echo Emsisoft Antimalware Is Missing Please Instal http://tinyurl.com/knd5aod &&pause
if %cc%==10 echo Ccleaner is Missing Please Install http://www.piriform.com/ &&pause
if %spb%==10 echo Spybot Search and Destroy is Missing Please Install http://www.safer-networking.org/ &&pause
>> %state% echo CLEANING YOUR SYSTEM Cleanmgr %time%
Cleanmgr /sagerun:1

:: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
cls
>> %state% echo CLEANING YOUR SYSTEM Emsisoft %time%
if %a2c%==1 echo Updating Emsisoft &&%amalu%
cls
if %cc%==1 echo Running Ccleaner File Clean &&%ccscf%
cls
if %cc%==1 echo Running Ccleaner Reg Clean &&%ccscr%
cls
if %spb%==1 if %Day%==7 echo Running Spybot Search and Destroy &&%spybot1%
cls
if %spb%==1 if %Day%==21 echo Running Spybot Search and Destroy &&%spybot1%
cls
if %mbytes%==1 echo Running MalwareBytes Antimalware &&%mbaS%
cls
if %a2c%==1 echo Emsisoft Antimalware Scanning &&%amals%
cls
echo Now Defragmenting YOUR HARD DRIVE
>> %state% echo DEFRAGMENTING YOUR SYSTEM %time%
%def% C:
echo Defraged C: %time%
%def% D:
echo Defraged D: %time%
%def% E:
echo Defraged E: %time%
%def% F:
echo Defraged F: %time%
del cleaning.tmp
>> %state% echo Clean3.bat Completed Successfully %time%
psshutdown /c /s /f /t 120
endlocal

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#3
February 28, 2014 at 13:58:18
✔ Best Answer
Oh, hey. Just noticed the problem. That line has Office style "smart" quotes, instead of standard, straight quotes. VBScript (and pretty much every computer language) only recognizes the straight quotes.

How To Ask Questions The Smart Way


Report •

Related Solutions


Ask Question