Does the Shell method work in VB Script?

G

Guest

Good Morning:

I've been trying to invoke Robert Sparnaaij's clear cache VB Script from VB
Script code on a custom Appointment Item form using the "Shell" method. I've
been getting "Type mismatch" runtime errors on "Shell"; indicating that it
appears that VB Script thinks that "Shell" is a variable and not a method.

Is the "Shell" method available in VB Script? If so, how do I get it to
work? If not, is there any other method I can use in VB Script to execute a
..VBS saved in a network drive. The path I want to use is
"\\servername\foldername\foldername\Clear_cache.vbs"

Thanks for your help.
 
K

Ken Slovak - [MVP - Outlook]

Something like this should work:

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "%windir%\notepad " & WScript.ScriptFullName
 
G

Guest

Thanks Ken.

This worked for me(the server-name is first):

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run
"\\sh19p001\wrkbench\Other_Projects\NASA\Clear_Cache\Clear_cache.vbs"

I just need to test to see if this works for our users. Granting
permissions to "Everyone" to the Clear_Cache directory should be all I need
to do to ensure that
this will work for all of our users across the country.

What is "%windir%"?
 
K

Ken Slovak - [MVP - Outlook]

%windir% is an environment variable that refers to C:\Winnt or C:\Windows
(depending on OS).

A script blocker would block that from running, script blockers don't like
CreateObject. Other than that if you have user permissions on wherever
you're writing to you should be OK.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top