Skip to content

Instantly share code, notes, and snippets.

@BoQsc
Created September 18, 2022 11:33
Show Gist options
  • Save BoQsc/1c1b0a6eab57d19ca60c833dc7e8f69a to your computer and use it in GitHub Desktop.
Save BoQsc/1c1b0a6eab57d19ca60c833dc7e8f69a to your computer and use it in GitHub Desktop.
Split string in Batch
@ECHO OFF
setlocal enabledelayedexpansion
set "_string=--User="C:/Your Friend/ asd/aaa /here""
echo %_string%
for /f "tokens=1* delims==" %%a in ("%_string%") do (
echo %%a
echo %%b
)
endlocal
PAUSE
EXIT /B
@BoQsc
Copy link
Author

BoQsc commented Sep 19, 2022

@ECHO OFF

setlocal enabledelayedexpansion
set "_string=--User="C:/Your Friend/ asd/aaa /here" --asdsa="woowie""
echo %_string%
for /f "tokens=1* delims==" %%a in ("%_string%") do (
  echo %%a 
  echo %%b
  for /f "tokens=1* delims=--" %%d in ("%%b") do (
  echo test %%d 
  echo test2 %%e
  )
  

)
endlocal


PAUSE
EXIT /B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment