running a bat file using psexec

create share 581 Reputation points


I need to run a psexec command on remote pcs that should first change the directory to

C:\program files (x86)\antivirus

and then run ch.exe file. I tried but failed. I tried running it locally on the PC with CMD but failed with error message: "The system cannot find the path specified"

What is the proper way to run exe files from the command prompt without first going to the directory path of the exe file?


Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
9,465 questions
Microsoft System Center
Microsoft System Center
A suite of Microsoft systems management products that offer solutions for managing datacenter resources, private clouds, and client devices.
665 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
6,727 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 77,641 Reputation points MVP

    Hi @create share ,

    to execute an exe with CMD just add the related full path in front of the exe. If the path contains spaces put "" around all.

    For instance:

    "c:\Program Files (x86)\Just A Test\write.exe"

    enter image description here

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards Andreas Baumgarten

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. create share 581 Reputation points

    Yes, it is working. I was making a mistake.


    0 comments No comments