Powershell to CMD

Welcome Forums General PowerShell Q&A Powershell to CMD

Viewing 1 reply thread
  • Author
    • #204939
      Topics: 3
      Replies: 2
      Points: 37
      Rank: Member


      When I call CMD as a different user in powershell, can I pass commands from Powershell to the CMD for execution?


      Start-Process cmd -Credential (Get-Credential "$env:USERDNSDOMAIN\")

      Once the window is open, I would like for it to process the command in the new CMD window:

      Echo Hello World!

      Thank you!

      • This topic was modified 3 months ago by PerDeSi91.
    • #204963
      Senior Moderator
      Topics: 8
      Replies: 1215
      Points: 4,334
      Helping Hand
      Rank: Community Hero

      of course, Use -ArgumanetList parameter will do the job.

      Start-Process -FilePath cmd.exe -ArgumentList 'echo HelloWorld' -Credential (Get-Credential)

      It’s always recommended and good read the help documentation for any cmdlet in PowerShell.

      Get-Help Start-Process -ShowWindow
Viewing 1 reply thread
  • The topic ‘Powershell to CMD’ is closed to new replies.