• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1548
  • Last Modified:

VBScript dialog box and how to run from shortcut

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.

  • 2
2 Solutions
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...
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."
   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.


Thanks for the grade.



Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now