PSExec Command to execute multiple cmd

@RealStruggler 21 Reputation points

Hello Guys,

I am having a bit of challenge executing two cmds using psexec.

Here's my command


But the same doesn't work with psexec


I have also tried the command below:

PSExec \Machinename cmd /c (hostname ^& bcdedit | find "path")

doesn't work.

Any suggestions please =)

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,460 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 34,271 Reputation points Microsoft Vendor

    Hi @@RealStruggler ,

    Try replacing parentheses with quotation marks

    PsExec \\Machinename cmd /c 'hostname && bcdedit |find "path"'  

    Best Regards,
    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Most helpful