Advertisement
Guest User

Untitled

a guest
Jun 12th, 2013
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.78 KB | None | 0 0
  1. @echo off
  2. setlocal enableextensions enabledelayedexpansion
  3. call:Concat cmd "this is a demo" " of concat functionality." " Hopefully it will work;" " but it doesn't when I pass an" " * asterisk" " character"
  4. echo %cmd%
  5.  
  6. @goto:end
  7. @goto:eof
  8.  
  9. set LF=^
  10.  
  11.  
  12. ::^ two empty lines are necessary !! ^
  13. :Concat
  14. ::Concatenates a given list of strings without including their quotes
  15. ::1 - output variable
  16. ::2* - strings to concat
  17. echo(#%*
  18. set /a xx=0
  19. set "Concat_tempFlag=0"
  20. set "Concat_temp="
  21. set tryl=%*
  22. set tryl=%tryl:" "="!LF!"%
  23. for %%A in ("%tryl%") do (
  24.     set /a xx+=1
  25.     echo !xx! - %%A
  26.     if !Concat_tempFlag!==1 (
  27.         set Concat_temp=!Concat_temp!%%~A
  28.     ) else (
  29.         set Concat_tempFlag=1
  30.     )
  31. )
  32. set "%~1="%Concat_temp%""
  33. @goto:eof
  34.  
  35. :End
  36. echo(Bye
  37. exit /b 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement