Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 783
  • 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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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