1
SET SS_SOURCE_PROJECT = sausages
@echo SS_SOURCE_PROJECT = %SS_SOURCE_PROJECT%

This isn't working, it just outputs:

SS_SOURCE_PROJECT =

But I am expecting

SS_SOURCE_PROJECT = sausages

This is on WinXP if it matters. What obvious dumb thing am I doing wrong?

2 Answers 2

3

remove spaces:

SET SS_SOURCE_PROJECT=sausages

Yes, batch syntax is terrible.

Sign up to request clarification or add additional context in comments.

3 Comments

Well, “terrible” on the one side is “easy to implement” on the other side ;-). As far as I know at least one Unix shell also has this specific behavior and yet there it's never called terrible but rather superior. Hm.
@Johannes: I don't know the unix shell very well, but sometimes I get the feeling that DOS only owns the terrible part of a shell syntax and just left out the superior bit.
I still have proving Turing-completeness of batch files on my todo list. but yes, there are nicer alternatives. Still, it's fun to write then, for me at least. I don't have as much fun writing shell scripts ;-)
2

To expand on @Stefan's answer, the original code works like this: (note the spaces)

C:\>SET SS_SOURCE_PROJECT = sausages

C:\>echo "%SS_SOURCE_PROJECT %"
" sausages"

1 Comment

1+, That's true, I didn't even think about it :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.