> I'd guess you need to escape the spaces in the original string?

Escaping didn’t help.

I’ve posted a complete description of the problem on Stackoverflow:

https://stackoverflow.com/questions/49922959/how-to-fix-java-was-unexpected-at-this-time-when-invoking-vs-2017-build-to


From: [email protected] 
[mailto:[email protected]] On Behalf Of Andrew Bayer
Sent: 18 April 2018 15:27
To: [email protected]
Subject: Re: Declarative script: How to escape 'Program Files (x86)'?

I'd guess you need to escape the spaces in the original string? I dunno - I 
don't have a Windows environment handy to test on.

A.

On Wed, Apr 18, 2018 at 6:28 AM, David Aldrich 
<[email protected]<mailto:[email protected]>> wrote:
My declarative script contains:

environment {
      VSMSBUILDCMD_14_0 = 'C:\\Program Files (x86)\\Microsoft<file://Microsoft> 
Visual Studio 14.0\\Common7\\Tools\\VsMSBuildCmd.bat'
    VSMSBUILDCMD_14_1 = 'C:\\Program Files (x86)\\Microsoft<file://Microsoft> 
Visual Studio\\2017\\BuildTools\\Common7\\Tools\\VsMSBuildCmd.bat'
}

<snip>

steps {
    bat '''
        call "%VSMSBUILDCMD_14_1%"
        msbuild <snip>
    '''

This results in error:

c:\jenkins\workspace\MyJob>call "%C:\Program Files (x86)\Microsoft Visual 
Studio\2017\BuildTools\Common7\Tools\VsMSBuildCmd.bat%"
\Java\jre1.8.0_161\bin"" was unexpected at this time.

I think I need to escape  ‘Program Files (x86)’.  What is the correct syntax 
for this please?

Best regards

David

--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/1780c53558db4c81b98ca30e74c2d40a%40EUX13SRV2.EU.NEC.COM<https://groups.google.com/d/msgid/jenkinsci-users/1780c53558db4c81b98ca30e74c2d40a%40EUX13SRV2.EU.NEC.COM?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAPbPdOY_r3oGaNMaa9SRYFsSg4QNSPOfWyvA66LLXsQXGZUogA%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CAPbPdOY_r3oGaNMaa9SRYFsSg4QNSPOfWyvA66LLXsQXGZUogA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


Click 
here<https://www.mailcontrol.com/sr/IIEedSqyYsLGX2PQPOmvUvSoGVaHHSWC2IjPf1UWv0+l6PrY3HXLfh6v9CIAb8Og!hXrwb5aayZAlVq5uz6AOA==>
 to report this email as spam.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ba57fb57aa034616af5fc3adceca58be%40EUX13SRV1.EU.NEC.COM.
For more options, visit https://groups.google.com/d/optout.

Reply via email to