Windows 2008 Server: Passing arguments to VBS script via SendTo folder

Posted on 2012-08-31
Last Modified: 2012-09-03

I would like to pass file names as arguments to a VBS script in a users SendTo folder of Windows 2008 server. For testing purposes I reduced the problem to the following:

created a test.vbs with the single line "MsgBox WScript.Arguments.Count" within "C:Users\<username>\AppData\Roaming\Microsoft\Windows\SendTo"
right clicked the file, chose "Send To / test.vbs"
got the message "0" (so no arguments were passed)

I did the same on a Windows 2003 Server where I got the message "1" (so one argument was passed, which is correct).

I need this script for automating an important process where I should be able to pass selected files to a script.

Any idea, why this works in Windows 2003 Server but not in Windows 2008 Server?

Thanks and best regards
Question by:mbwjk
    LVL 43

    Accepted Solution

    Works fine on my Windows 2008 box.

    I wonder if there is a problem with your file association of vbs.

    What do you have here:


    Without the %* on the end to pass the command line to the script it would have that effect, maybe because VBS has been manually associated with wscript or cscript by ticking "always use this to open this sort of file" at some point?

    "%SystemRoot%\System32\WScript.exe" "%1" %*

    HKEY_CLASSES_ROOT\.vbs   should have a (default) entry as VBSFile


    Author Closing Comment

    Hi Steve,

    thats absolutely great - it worked right away.

    You were right: The %* parameter was missing.

    Thanks a lot and best regards!
    LVL 43

    Expert Comment

    by:Steve Knight
    No problem, in some cases Windows is actually logical in what it does!

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  ( Here (http…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

    734 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

    17 Experts available now in Live!

    Get 1:1 Help Now