psexec를 사용하여 원격 서버에서 배치 파일 실행

psexec를 사용하여 원격 서버에서 배치 파일 실행

하나의 기본 Bat 파일에서 해당 배치 파일을 호출하는 배치 파일이 약 10개 있습니다. 이제 원격 서버에서 모든 bat 파일을 실행하고 싶습니다.

다음 명령을 사용하여 원격 서버에서 실행할 배치 파일을 실행했습니다.

psexec \\10.47.36.182 -c C:\Users\SVCT\Desktop\samples\_main_script.bat

위 명령을 실행하는 동안 얻은 결과는 다음과 같습니다.

PsExec v2.2 - Execute processes remotely
Copyright (C) 2001-2016 Mark Russinovich
Sysinternals - www.sysinternals.com

The system cannot find the file C:\Users\SVCT-WI-Jenkins\Desktop\test.log.
The system cannot find the path specified.
C:\WINDOWS\system32>The system cannot find the path specified.
REM @Echo Off

시스템이 지정된 경로를 찾을 수 없습니다. 시스템이 지정된 경로를 찾을 수 없습니다.

다음은 내 주요 배치 파일입니다.

REM @Echo Off
SetLocal EnableDelayedExpansion
::This line is just in case n has been defined before the batch file is run
Set n=
Set InputFile=C:\Users\SVCT-WI-Jenkins\Desktop\test.log
For /F "tokens=*" %%I IN (%InputFile%) DO (
Set /a n+=1
Set var!n!=%%I
REM echo "%var!n!%"
)
EndLocal & (
  set "cluster_check=%var1%"
  set "servername=%var2%"
  set "servername1=%var3%"
  set "artifact_folder=%var4%"
)

call C:\Users\SVCT-WI-Jenkins\Desktop\Scripts_palani_new\samples\1_cluster_check.bat %cluster_check%
echo %enviroment%
echo %enviroment%

call C:\Users\SVCT-WI-Jenkins\Desktop\Scripts_palani_new\samples\2_server_connectivity.bat %servername%

누군가 이 문제를 해결하도록 도와줄 수 있습니까? 원격 서버에서 모든 bat 파일을 실행해야 합니다.

관련 정보