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

后端 未结 4 1270
日久生厌
日久生厌 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:00

    You can use WMIC or SCHTASKS (which means no third party software is needed):

    1) SCHTASKS:

    SCHTASKS /s remote_machine /U username /P password /create /tn "On demand demo" /tr "C:\some.bat" /sc ONCE /sd 01/01/1910 /st 00:00
    SCHTASKS /s remote_machine /U username /P password /run /TN "On demand demo" 
    

    2) WMIC (wmic will return the pid of the started process)

    WMIC /NODE:"remote_machine" /user user /password password process call create "c:\some.bat","c:\exec_dir"
    

提交回复
热议问题