Reputation: 86925
How can I hand a string that contains whitespaces as single paramter?
SET STRING=this is my teststring
call .\newFile.cmd %STRING%
newFile.cmd:
ECHO %1% //gives: "this"
Upvotes: 1
Views: 59
Reputation: 82418
Try it with
SET STRING=this is my teststring
call .\newFile.cmd "%STRING%"
newFile.cmd:
ECHO %~1
The %~1
removes surrounding quotes.
Upvotes: 2
Reputation: 2042
There are two ways:
1 - Use quotes around the string
SET STRING="this is my teststring"
2 - Escape the spaces
SET STRING=this\ is\ my\ teststring
Upvotes: 1