Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal enableextensions enabledelayedexpansion
- call:Concat cmd "this is a demo" " of concat functionality." " Hopefully it will work;" " but it doesn't when I pass an" " * asterisk" " character"
- echo %cmd%
- @goto:end
- @goto:eof
- set LF=^
- ::^ two empty lines are necessary !! ^
- :Concat
- ::Concatenates a given list of strings without including their quotes
- ::1 - output variable
- ::2* - strings to concat
- echo(#%*
- set /a xx=0
- set "Concat_tempFlag=0"
- set "Concat_temp="
- set tryl=%*
- set tryl=%tryl:" "="!LF!"%
- for %%A in ("%tryl%") do (
- set /a xx+=1
- echo !xx! - %%A
- if !Concat_tempFlag!==1 (
- set Concat_temp=!Concat_temp!%%~A
- ) else (
- set Concat_tempFlag=1
- )
- )
- set "%~1="%Concat_temp%""
- @goto:eof
- :End
- echo(Bye
- exit /b 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement