Reputation: 5072
For example if %USERNAME% = foo.bar
, I would like to change it to be FooBar
- removing the dot and camel casing.
So far I've only attempted to remove the "dot",
@echo off
@setlocal EnableDelayedExpansion
set new=!%USERNAME%:.=!
echo %new%
but this returns .=
. I'm not very good with Windows batch scripting (obviously) so thanks in advance!
Upvotes: 0
Views: 57
Reputation: 79983
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET "name=foo.bar"
ECHO was:%name%
SET "name=.%name%"
FOR %%L IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO SET "name=!name:.%%L=.%%L!"
SET "name=%name:.=%"
ECHO now:%name%
GOTO :EOF
Upvotes: 3