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

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

Hi,

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
Chris
0
mbwjk
Asked:
mbwjk
  • 2
1 Solution
 
Steve KnightIT ConsultancyCommented:
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:

HKEY_CLASSES_ROOT\VBSFile\Shell\Open\Command

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

Steve
0
 
mbwjkAuthor Commented:
Hi Steve,

thats absolutely great - it worked right away.

You were right: The %* parameter was missing.

Thanks a lot and best regards!
Chris
0
 
Steve KnightIT ConsultancyCommented:
No problem, in some cases Windows is actually logical in what it does!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

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