Results 1 to 4 of 4

Thread: Running Powershell script with batch file with parameters?

  1. #1
    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?

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    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).

  3. #3
    Join Date
    Apr 2008
    Posts
    1,948

    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!

  4. #4
    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

Similar Threads

  1. How to rename Batch File with Windows PowerShell
    By Akiraa in forum Tips & Tweaks
    Replies: 0
    Last Post: 25-08-2012, 12:06 PM
  2. batch script to find a file
    By stevenwhite in forum Software Development
    Replies: 1
    Last Post: 10-04-2012, 12:55 PM
  3. Powershell script to parse system logs in text file
    By SADIQ in forum Operating Systems
    Replies: 2
    Last Post: 02-06-2009, 07:05 PM
  4. Batch Script Text file parse
    By tator.usenet@gmail.com in forum Windows Server Help
    Replies: 5
    Last Post: 25-03-2009, 02:12 AM
  5. How can I play a Wav file from batch/cmd script?
    By NaFula in forum Windows Vista Performance
    Replies: 3
    Last Post: 13-09-2008, 09:21 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,499,057.98550 seconds with 17 queries