VBScript dialog box and how to run from shortcut

Posted on 2009-02-09
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\  j:\commonstorage\myscript.scr).

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

Question by:schmir1
    LVL 67

    Assisted Solution

    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...
    LVL 65

    Accepted Solution

    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.


    LVL 65

    Expert Comment

    Thanks for the grade.



    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    problem with for loop, looping forever, not exiting 5 53
    Scripting Problem 9 37
    exchange 2007 3 44
    shell script to send sms 2 37
    The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
    Recently, an awarded photographer, Selina De Maeyer (, completed a photo shoot of a beautiful event ( in An…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now