Executing Batch File Using PowerShell

This topic contains 2 replies, has 2 voices, and was last updated by  Dilip Dodiya 3 years, 3 months ago.

  • Author
  • #23609

    Dilip Dodiya

    Hi There- Need help to execute cmd file (batch file) from PowerShell script. Please let me know if anyone did this. Thank You, Dilip

  • #23611

    Dave Wyatt

    You can execute .cmd or .bat files the same way you execute any other external program. For example:

    c:\script.cmd Arg1 "Arg 2"
  • #23614

    Dilip Dodiya

    Thank you Dave. Just now I tried below and it worked.

    [b][i]Start-Process -FilePath "C:\PSDemo\CopyFile.bat" "C:\Source" "C:\Destination" -WindowStyle Hidden[/i][/b]

You must be logged in to reply to this topic.