his is my question!
I want to run Powershell script with batch file with parameters?
How can you pass parameters to a batch file?
his is my question!
I want to run Powershell script with batch file with parameters?
How can you pass parameters to a batch file?
Parameters are extra pieces of information that you type after many of the DOS commands. For example, "DIR B: /W" contains the parameters B: and /W. These modify the basic operation of the command, but are not required by the command. You pass parameters to a batch file in the same manner; by typing the information after the batch command, but before tapping the Enter key. The parameters may be used in any place in the batch file where a parameter would normally be used as part of the DOS command being run. Markers are used within the batch file to signify which parameter goes where. Markers are comprised of a percent sign (%) and a single digit between 0 and 9 (that's ten markers in use at any one time; remember, zero is a number).
In this simple example, three parameters were passed to the batch file and were placed into the ECHO command in the order received. Only the first and third are shown as only those were referenced in the batch file.
The parameters and markers were related as follows...
* %1 is marker 1 and, in this example, represents "Red", the first parameter;
* %3 is marker 3 and, in this example, represents "Green", the third parameter;
* %2 would be marker 2 but, in this example, is not present so "Blue", the second parameter, is ignored.
Note: Marker zero is assigned the name of the batch file in the form you typed it in (i.e., all caps, all lower case, or a mixture).
Please have a look at this page too1
http://windowsitpro.com/articles/ind...=13443&cpage=2
I hope this helps you!
You can also use this free utility, PShellExec to handle your script and function parameters in a secure environment:
Last edited by Kunal; 12-01-2011 at 10:32 AM. Reason: External Linking is not allowed
Bookmarks