We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

VBScript dialog box and how to run from shortcut

schmir1
schmir1 asked
on
Medium Priority
1,569 Views
Last Modified: 2012-05-06
I'm interested in starting to use VBScript to install my database on users PC.  I've got a few questions:
1) Can VBScript display a dialog box?  If so how would I do the following:
       a) Display dialog asking user "Do you want to install the database", with Yes/No buttons
       b) Code to process Yes or No response

2) Can my users run my VBScript script by clicking on a shortcut?  If so, what do I need for shortcut properties (e.g., c:\winnt\vbscriptapp.com  j:\commonstorage\myscript.scr).

3) Can all my users run VBScript without installation of any additional software?  They all have Windows XT SP2.


Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2007
Commented:
strResp = Msgbox ("Do you want to install the database?", vbYesNo, "Prompt")
If strResp = vbNo Then wscript.quit

'Continue with strResp = vbYes

Yes, users can simply double-click it and run without any additional software...

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
Hi, just to expand on sirbounty's comment a bit, you can use the following code:

strResponse = Msgbox ("Do you want to install the database?", vbYesNo, "Install Database?")
If strResponse = vbYes Then
   Set objFSO = CreateObject("Scripting.FileSystemObject")
   objFSO.CopyFile "\\server\share\myDB.mdb", "C:\Program Files\My Program\", True
   MsgBox "Database has been copied."
Else
   MsgBox "Database will not be copied."
End If


Users can run a shortcut, as long as your shortcut is
wscript.exe \\server\share\MyScript.vbs

On Windows XP, the Windows Script Host 5.6 should be installed, and so all VBScripts should run fine without further requirements.

Regards,

Rob.
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
Thanks for the grade.

Regards,

Rob.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.