Command line arguments to vbs file


















If you need direct access: WScript. Item 0 WScript. Item Jerther Jerther 5, 7 7 gold badges 35 35 silver badges 54 54 bronze badges.

You can also drag and drop a file onto a script in Explorer, which will run the script with the first argument set to the file path and name. You might want to use WScript. Count with this. How would I pass an array object e. Sign up or log in Sign up using Google. Sign up using Facebook.

Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Helping communities build their own LTE networks. In many ways it is similar to the previous script, but it uses some new features. David Carlson ' ' Date: March 14, ' ' This WSH script reports on the file or files supplied as command-line arguments ' to this script. For each such file, the output shows the name of the file, the ' date it was last changed, and the file type.

CreateObject "WScript. Echo "Usage: [cscript wscript] filereport. CreateObject "Scripting. GetFile args. But just to be sure, here is a quick summary: As in the previous example, this script generates an error message and quits if the user failed to supply at least one parameter. Throughout the script a message string is built up in the variable cMsg. It is echoed at the end of the script. The loop goes through all of the arguments to the script by looking at args. Item k as k runs from 0 to num - 1.

In each case, args. Item k is the pathname for a file. The GetFile method returns a File object containing information on this particular file. For example:. To find how command line arguments can be changed in the user interface of the application you are using, search Help for "command line arguments. This example uses the Command function to get the command line arguments in a function that returns them in a Variant containing an array.

Not available in Microsoft Office. Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.



0コメント

  • 1000 / 1000