trimspace in bact file
@echo off
set str = This string has a lot of spaces
echo %str%
set str=%str:=%
echo %str%
trimspace in bact file
@echo off
set str = This string has a lot of spaces
echo %str%
set str=%str:=%
echo %str%
trim all space in bact file
@echo off
setlocal EnableDelayedExpansion
set S= This is a test
echo %S%.
for /f "tokens=* delims= " %%a in ('echo %S%') do (set b=%%a & set b=!b: =_! & echo !b!)
endlocal & goto :EOF
trim all space in bact file
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET /p NAME=- NAME ?
ECHO "%NAME%"
CALL :TRIM NAME
ECHO "%NAME%"
GOTO :EOF
:TRIM
SetLocal EnableDelayedExpansion
Call :TRIMSUB %%%1%%
EndLocal & set %1=%tempvar%
GOTO :EOF
:TRIMSUB
set tempvar=%*
GOTO :EOF
trim all space in bact file
:Trim
SetLocal EnableDelayedExpansion
set Params=%*
for /f "tokens=1*" %%a in ("!Params!") do EndLocal & set %1=%%b
exit /b
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us