-1

Met same problem: using cmd's Start command to run exe. Works locally, but not remotely But solution does not work for me - I use full path to *.exe file

The task is install copy application installer from my computer (Win7, x64) to remote desktop (Win10, x64) with checking the installer version is newer than installed. So, I have two *.bat, one running from another via psexec. Part of the first .bat below. Here copy installer to remote

NET use x: \\%compname%\%sharefolder% /user:%login% %pass%
xcopy %InstallerFolder%\%InstallerFile% x:\  /s /e /d /y
NET use x: /delete

Then run InstallProcess.bat:

%InstallerFolder%\PsExec.exe \\%compname% -f -u %login% -p %pass% /c %InstallerFolder%\InstallProcess.bat

Also tried PsExec64.exe All is fine except start command:

START "" /WAIT C:\%sharefolder%\%InstallerFile% /DIR="C:\Program Files (x86)\MyApp\"  /sp- ^
/verysilent ^
/suppressmsgboxes ^
/closeapplications ^
/components="..." ^
/tasks="..." ^
/log="%~n0.log"

It does not work. Just like without this command. InstallProcess.bat error code = 0. But if i run InstallProcess.bat locally on %compname% it works fine.

Thanks!

Sergei
  • 1
  • "The task is install copy application installer...". Word "install" is excess. Sorry – Sergei Mar 05 '19 at 19:51
  • Why are you using `START /WAIT`? You shouldn't need it at all. – Squashman Mar 05 '19 at 20:04
  • Try using the `/D` option. `START "" /WAIT /D "C:\%sharefolder%\" "%InstallerFile%" .....` – Squashman Mar 05 '19 at 20:15
  • @Squashman, thanks for answers, but doesnt work anyway. START "" /WAIT /D ... leads to message: "Invalid key: /sp-". START "" /D ... - same. START "" /WAIT /D... - "Could not execute batch command". And dont understand what you mean in fisrt comment - what should I use instead of START /WAIT – Sergei Mar 05 '19 at 20:40
  • 1
    You do not need the `START` command to execute a program. Just remove `START /WAIT` from your code and just execute the installer file as is. – Squashman Mar 05 '19 at 20:56
  • @Squashman, thanks, did not know that..But doesnt help as well – Sergei Mar 05 '19 at 21:12
  • Telling us it doesn't work doesn't help us help you troubleshoot the problem. – Squashman Mar 05 '19 at 21:15
  • Where these variables are defined `%sharefolder%\%InstallerFile%`? Are they defined on a remote side? – montonero Mar 06 '19 at 07:06
  • @montonero Yes, they are defined in both *.bat. Before executing "start" check this path via echo, result: C:\TestAutoInstall\MyAppInstaller.exe – Sergei Mar 06 '19 at 07:14
  • Does it create a log file? – montonero Mar 06 '19 at 07:22
  • @montonero No, it does not. Try to create simple SomeFile.cmd file on remote desktop with "echo sometext" and use it instead of my code: start /min /wait cmd /c C:\TestAutoInstall\SomeFile.cmd. Did not found this output. Maybe there is an easier way to meet my requirements - without two .bat files or psexec? So I should try something else – Sergei Mar 06 '19 at 07:42
  • So far `psexec` is a simplest way to do a remote run. Just in case: `start` is an internal command. of `cmd.exe` you can't run it by its own. – montonero Mar 06 '19 at 07:55

1 Answers1

0

Solved. Missing -s. Thanks for help.

%InstallerFolder%\PsExec.exe -s \\%%c -f -u %%a -p %%b -c %InstallerFolder%\InstallProcess.bat
Sergei
  • 1