I'm basically looking for the opposate of this post: https://stackoverflow.com/questions/47796707/how-to-extract-text-after-in-batch-file. I'm looking to extract the text before an equal sign in a string of text (or remove the text after the equal sign and the equal sign).
Example Input:
User=Your Friend
Desired Output:
User
Since the length of the text before and after the equal sign varies I cant use something like %var:~0,-12%
.
Use the following batch file (test.cmd):
@echo off
setlocal enabledelayedexpansion
set _string=User=Your Friend
echo %_string%
for /f "tokens=1 delims==" %%a in ("%_string%") do (
echo %%a
)
endlocal
Example output:
> test
User=Your Friend
User
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다