Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , ,

Sponsored Links



Running Powershell script with batch file with parameters?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 17-02-2009
Jaslein's Avatar
Member
 
Join Date: Jan 2008
Posts: 17
Running Powershell script with batch file with parameters?

his is my question!
I want to run Powershell script with batch file with parameters?
How can you pass parameters to a batch file?
Reply With Quote
  #2  
Old 17-02-2009
Member
 
Join Date: May 2008
Posts: 1,990
Re: Running Powershell script with batch file with parameters?

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).
Reply With Quote
  #3  
Old 17-02-2009
Praetor's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,937
Re: Running Powershell script with batch file with parameters?

Please have a look at this page too1

http://windowsitpro.com/articles/ind...=13443&cpage=2

I hope this helps you!
Reply With Quote
  #4  
Old 12-01-2011
Member
 
Join Date: Jan 2011
Posts: 1
Re: Running Powershell script with batch file with parameters?

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
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Running Powershell script with batch file with parameters?"
Thread Thread Starter Forum Replies Last Post
Running a batch file Timbo Vista Help 4 26-09-2009 03:40 AM
Powershell script to parse system logs in text file SADIQ Operating Systems 2 02-06-2009 08:05 PM
Batch Script Text file parse tator.usenet@gmail.com Windows Server Help 5 25-03-2009 03:12 AM
How can I play a Wav file from batch/cmd script? hbfavor Windows Vista Performance 7 13-09-2008 10:21 PM
How to create a script in a DOS batch file to do a loop? Jon Osborn Windows Server Help 2 27-05-2008 07:41 PM


All times are GMT +5.5. The time now is 11:14 AM.