Execute a batch file on a remote PC using a batch file on local PC

后端 未结 4 1267
日久生厌
日久生厌 2021-02-19 02:33

I want to execute a batch file

D:\\apache-tomcat-6.0.20\\apache-tomcat-7.0.30\\bin\\shutdown.bat

Which is on my server inidso

4条回答
  •  隐瞒了意图╮
    2021-02-19 03:02

    Use microsoft's tool for remote commands executions: PsExec

    If there isn't your bat-file on remote host, copy it first. For example:

    copy D:\apache-tomcat-6.0.20\apache-tomcat-7.0.30\bin\shutdown.bat \\RemoteServerNameOrIP\d$\apache-tomcat-6.0.20\apache-tomcat-7.0.30\bin\
    

    And then execute:

    psexec \\RemoteServerNameOrIP d:\apache-tomcat-6.0.20\apache-tomcat-7.0.30\bin\shutdown.bat
    

    Note: filepath for psexec is path to file on remote server, not your local.

提交回复
热议问题