VBS Scripts

  • Thread starter Thread starter Geordie
  • Start date Start date
As I said before, I can smell a rat. Let's try and nail this one
down. Please follow the instructions below ***verbatim***,
without deviating one bit!
1. Click Start / Run / cmd{OK}
This will give you a black Command Prompt screen.
2. Type these commands:
echo wscript.echo "Hello world" > c:\test.vbs{Enter}
%SystemRoot%\system32\cscript.exe c:\test.vbs{Enter}
3. Report what you see on the screen.

Hi,
Thanks for your help & patience.
These are the results.
Clicked Start..Run..typed cmd...OK
Black screen appeared with this. C:\Documents and Setting\Maurice>
I typed in. echo wscript.echo "Hello world" > c:\test.vbs then Enter
The screen then went to. C:\Documents and Setting\Maurice>
I then typed.%SystemRoot%\system32\cscript.exe c:\test.vbs then Enter
Screen reported this Microsoft <R> Windows Script Host Version 5.6
copyright <C> Microsoft Corp 1996-2001 all rights reserved.
Hello world
C:\Documents and Setting\Maurice>

What started this thread, I had a restore.vbs file which I got off Doug's
site,it has been on my PC for at least 2 years and has not been altered or
even moved,it used to work on numerous occasions until I upgraded to SP3
then I started to get the error message.I copied the file and tested it on
another PC the same as mine XP home SP3 and it worked fine.
I only used to double click the file and it would work,I don't understand
what I can be doing wrong with a simple double click.
Thanks
 
Geordie said:
Hi,
Thanks for your help & patience.
These are the results.
Clicked Start..Run..typed cmd...OK
Black screen appeared with this. C:\Documents and Setting\Maurice>
I typed in. echo wscript.echo "Hello world" > c:\test.vbs then Enter
The screen then went to. C:\Documents and Setting\Maurice>
I then typed.%SystemRoot%\system32\cscript.exe c:\test.vbs then Enter
Screen reported this Microsoft <R> Windows Script Host Version 5.6
copyright <C> Microsoft Corp 1996-2001 all rights reserved.
Hello world
C:\Documents and Setting\Maurice>

What started this thread, I had a restore.vbs file which I got off Doug's
site,it has been on my PC for at least 2 years and has not been altered or
even moved,it used to work on numerous occasions until I upgraded to SP3
then I started to get the error message.I copied the file and tested it on
another PC the same as mine XP home SP3 and it worked fine.
I only used to double click the file and it would work,I don't understand
what I can be doing wrong with a simple double click.
Thanks

The result of this test proves that in the previous tests you ran
a script other than the one you thought you were running. You
should now build up on this knowledge by doing the following:
1. Click Start / Run / cmd{OK}
This will give you a black Command Prompt screen.
2. Type these commands:
cd /d c:\Windows{Enter}
notepad restore.vbs{Enter}
{Paste the lines from Doug Knox's site into this file}
{Save & close the file}
%SystemRoot%\system32\cscript.exe c:\windows\restore.vbs{Enter}
c:\windows\restore.vbs{Enter}
3. Report what you see on the screen. I expect the results from the
last two commands to be the same.
 
The result of this test proves that in the previous tests you ran
a script other than the one you thought you were running. You
should now build up on this knowledge by doing the following:
1. Click Start / Run / cmd{OK}
This will give you a black Command Prompt screen.
2. Type these commands:
cd /d c:\Windows{Enter}
notepad restore.vbs{Enter}
{Paste the lines from Doug Knox's site into this file}
{Save & close the file}
%SystemRoot%\system32\cscript.exe c:\windows\restore.vbs{Enter}
c:\windows\restore.vbs{Enter}
3. Report what you see on the screen. I expect the results from the
last two commands to be the same.

Hi,
When I get to this part
%SystemRoot%\system32\cscript.exe c:\windows\restore.vbs{Enter}
I get this message on the screen
Microsoft <R> windows scripthost Ver 5.6
copyright <C> Microsoft Corp 1996-2001 all rights reserved.
c:\windows\restore.vbs <2, 17> SWbemObject:no such interface reported.
Then after c:\windows\restore.vbs{Enter}
A error messagae appears in a small blue box with the heading Windows
Script Host
line 2
char 1
Error No such interface supported
Code 80004002
Source SWbemObjectEX
 
Geordie said:
Hi,
Thanks for your help,when I try to use the above script,this is the error
message that appears.

line 1
char 14
Error Expected end of statement
code 800A0401
source microsoft VBScript compilation error

Sorry, your response is inherently contradictory. Line 1 of the code
you show is a comment line, hence it cannot possible generate an
error message.

Instead of trying to leap shortly after you have learnt to crawl, try
to walk first. Here is how you can it it, using your own script as a
starting point.
1. Click Start / Run / cmd{OK}.
2. Type this commands:
cd /d c:\{Enter}
notepad c:\test.vbs{Enter}
{Click OK when prompted to create a new file}
{copy & paste these 6 lines into your notepad session:}
'Auto Restore Point for Vista
Set WshShell = CreateObject("WScript.Shell")
WshShell.Popup "Restore will start in 5 seconds", _
5, "AutoRestore", 65
WshShell.Popup "It will take 10 seconds" , 4, _
"Creating File",65
{Save & close the file}
cscript c:\test.vbs{Enter}
3. Report the result
 
Hi,
I tried this several times and after typing the final line, cscript
c:\test.vbs{Enter}
The small blue box which usually reports an error appeared with the option
of restore will start in 5 seconds OK etc then seconds later restore will
start in 10 seconds OK etc.

Regards,
Geordie
 
Geordie said:
Hi,
I tried this several times and after typing the final line, cscript
c:\test.vbs{Enter}
The small blue box which usually reports an error appeared with the option
of restore will start in 5 seconds OK etc then seconds later restore will
start in 10 seconds OK etc.

Regards,
Geordie

This is what I expected. In other words, the first lines of your
script finally do what they are supposed to do. You must have
been off at some far flung corner of the universe when you ran
your previous script.

Now continue with the method I outlined before but add one
single line of code at a time to build up your confidence. I will
show you the next version of the script:

'Auto Restore Point for Vista
Set WshShell = CreateObject("WScript.Shell")
WshShell.Popup "Restore will start in 5 seconds", _
5, "AutoRestore", 65
WshShell.Popup "It will take 10 seconds" , 4, _
"Creating File",65
Set sr = getobject("winmgmts:\\.\root\default:Systemrestore")

Please do not rush into this - take it nice and easy, one
step at a time. When you fail, go back one step and try
again.
 
Geordie said:
OK, I have done that and the blue box pops up just like last time.
Restore will start in 5 seconds OK cancel
after a few seconds
It will take 10 seconds.OK cancel

Regard,
Geordie.

Good. Now as I said, keep adding lines until you have the
whole script together. You should then spend some time
thinking about what you're doing differently now compared
to before so that you get to understand why your script failed
so persistently on all previous occasions.
 
Good. Now as I said, keep adding lines until you have the
whole script together. You should then spend some time
thinking about what you're doing differently now compared
to before so that you get to understand why your script failed
so persistently on all previous occasions.

I tried this approx 10 times yesterday and several times today,it works OK
until I type or copy & paste the following lines as instructed.
----------------------------------------------------
If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) = 0 Then
MsgBox phm
This single line when added brings up the blue box with an error message
Script C:\Test.vbs
Line 12
char 15
Error expected "end"
Code 800A03f6
Source Microsoft VBScript compilation error
-----------------------------------------------------
Else
MsgBox "Restore Point creation Failed!"
End If
----------------------------------------------------
When both lines are added, the error box after going through the 5 & 10
second routine brings up this.
Script C:\Test.vbs
Line 11
char 1
Error No such interface supported
Code 80004002
Source SWbemObjectEx

I have copied this file,test.vbs & tried it on 2 other PCs XP (Home SP3)
and it worked fine on both of them.
I believe that this exercise has finally proven that there is a fault on
the OS of this PC & not my typing or double clicking on files which have
been compiled by Doug Knox or Kelly etc with instructions to download,then
double click and do not work on mine but are OK on other PCs.
As PaulM stated, he doesn't know what I am doing wrong because they work
fine on everyone else's PC, this is what I could not understand from the
start of this thread and is why I originally asked for help.
I really don't know what else to try.
 
Geordie said:
I tried this approx 10 times yesterday and several times today,it works OK
until I type or copy & paste the following lines as instructed.
----------------------------------------------------
If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) = 0 Then
MsgBox phm
This single line when added brings up the blue box with an error message
Script C:\Test.vbs
Line 12
char 15
Error expected "end"
Code 800A03f6
Source Microsoft VBScript compilation error
-----------------------------------------------------
Else
MsgBox "Restore Point creation Failed!"
End If
----------------------------------------------------
When both lines are added, the error box after going through the 5 & 10
second routine brings up this.
Script C:\Test.vbs
Line 11
char 1
Error No such interface supported
Code 80004002
Source SWbemObjectEx

I have copied this file,test.vbs & tried it on 2 other PCs XP (Home SP3)
and it worked fine on both of them.
I believe that this exercise has finally proven that there is a fault on
the OS of this PC & not my typing or double clicking on files which have
been compiled by Doug Knox or Kelly etc with instructions to download,then
double click and do not work on mine but are OK on other PCs.
As PaulM stated, he doesn't know what I am doing wrong because they work
fine on everyone else's PC, this is what I could not understand from the
start of this thread and is why I originally asked for help.
I really don't know what else to try.

If I was in your situation then I would try the script on
some other machine. There are two possible outcomes:
a) If it works there then there is something wrong with your PC.
You may have to reload Windows from scratch.
b) If it does not work there then there is something wrong with
the way you're doing things. Get someone who knows about
programming to look over your shoulder while you're creating
and running this code.
There is a third option, which I do not recommend: Open up
your PC for remote access so that I can see for myself what's
going on. Drop me a line on pegasus_fnlATyahooDOTcom
if you wish to consider this option. Other than this I will now
stop monitoring this thread.
 
Back
Top