Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there a way to pass parameters to a VBS script used for a custom field within bginfo?

What I have tried:

NOTE: The way to retrieve them with WScript.Arguments.Item(0) doesn't work, because WScript is not defined/supported within bginfo/vbs engine.
Posted
Updated 3-Nov-23 4:41am
v2

1 solution

It looks like you asked this in the Microsoft forums two years ago.

BgInfo doesn't use the WScript. It hosts the scripting engine itself. As far as I can tell, BgInfo doesn't support passing command line parameters to the script. Frankly, I don't see a reason you would for what the tool does. Scripts for this tool should be entirely self-contained.

You can get around this though. You can create an environment variable(s) with the data you want to pass and pickup those value of those variables in the script by creating a WScript.Shell object and calling its ExpandEnvironmentStrings method.
 
Share this answer
 
Comments
ImfeldC (Switzerland) 2-Nov-23 11:03am    
Yes, I asked the same question two years ago in Microsoft forum and didn't get an answer. In this forum I got an answer within 15' .... Wouw! :-)

I would like to use the same script to retrieve several different custom values (approx. 10-15 values). The retrieval process is for all values the same, as they are retrieved from same website/API. The decision what to retrieve would be done with this parameter.
Workaround is, to create one main script and create for each custom value an own separate script, which calls the main method (loaded from main script). Creating 10-15 scripts is cumbersome, it would be much easier to just pass a parameter to the script, when setting-up custom value.

Anyhow, many thanks for your answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900