Snapin fails when arguments contain quotes



  • I have noticed that batch script snapins, that run correctly without quotes, fail when the snapin arguments include them.

    To test, I created a simple batch script snapin file with the code:

    set parameter="%~1"
    echo %parameter%
    

    and pass these parameters to it:
    0_1525885409164_TestScriptSnapin.png

    The snapin

    • fails when Snapin Arguments contain quotes: e.g. "FooBar" > c:\test.txt
      c:\test.txt is created empty and fog.log shows:
      5/9/2018 12:07 PM Middleware::Response Success
      5/9/2018 12:07 PM SnapinClient Running snapin Test Script
      5/9/2018 12:07 PM SnapinClient C:\Program Files (x86)\FOG\tmp\test.bat
      5/9/2018 12:07 PM SnapinClient Starting snapin
      5/9/2018 12:07 PM SnapinClient Snapin finished
      5/9/2018 12:07 PM SnapinClient Return Code: 1

    • succeeds when Snapin Arguments do not include quotes: FooBar > c:\test.txt
      c:\test.txt contains the echoed parameter FooBar and fog.log shows:
      5/9/2018 12:10 PM Middleware::Response Success
      5/9/2018 12:10 PM SnapinClient Running snapin Test Script
      5/9/2018 12:10 PM SnapinClient C:\Program Files (x86)\FOG\tmp\test.bat
      5/9/2018 12:10 PM SnapinClient Starting snapin
      5/9/2018 12:10 PM SnapinClient Snapin finished
      5/9/2018 12:10 PM SnapinClient Return Code: 0

    Another snapin attempt (to install Dymo Label Software) fails to run with the required arguments DLS8Setup.8.7.exe /S /V”/qn /norestart”, but succeeds when manually executing from the host’s command line.

    I can workaround this problem by writing these into the batch file, but it would be handy to simply pass parameters with quotes.

    My environment: FOG 1.4.4 on Centos 7, client 0.11.12 on Windows 10.

    Thanks in advance!


  • Senior Developer

    @fogjam this is definitely not expected behavior, thanks for reporting it. I’ll look into it and post in this thread with my findings.



  • Asking @joe-schmitt to take a look at this.


 

449
Online

41.9k
Users

12.4k
Topics

116.8k
Posts