psexec exited with error code 1 - double quotes

35,851
psexec -u user -p pass cmd /c "d:\GitRepos\runAll.bat a1 a2 "a3""
Share:
35,851
Allan Bowe
Author by

Allan Bowe

SAS Consultant Projects: https://sasjs.io - Framework for building web apps on SAS https://sasensei.com - quiz game for SAS https://datacontroller.io - data capture, governance & approval https://rawsas.com - SAS blog

Updated on July 09, 2022

Comments

  • Allan Bowe
    Allan Bowe almost 2 years

    Why does the psexec-executed command below fail when I add double quotes to the parameter?

    • It works fine without psexec with double quotes
    • It works fine with psexec without double quotes!

    enter image description here

    The contents of the .bat file are as follows:

    set FILEPATH=%~1
    set BAT_ARCHIVE_IDENTIFIER=%~2
    set DEPLOYMENT_ROOT=%~3
    echo %FILEPATH% %BAT_ARCHIVE_IDENTIFIER% %DEPLOYMENT_ROOT%
    
  • Allan Bowe
    Allan Bowe almost 10 years
    Just what I needed! Thanks!