Copying first character from a var with space

So far I have created a batch file that breaks up an entered word and changes each letter to something else and rebuilds it afterwards. So just for now it encrypts a word.

I'm trying to get it to encrypt a sentence including spaces.The way it works is it grabs the first letter, sets it as variable i, then removes the first letter. This loops till all the input is gone and all the characters have been broken down into pieces.

Here's the code for copying first letter then deleting it. (input = sentence to be broken down)

SET i=%input:~0,1% //copies first letter and saves it into iSET input=%input:~1% // deletes the first letter

It works perfectly until it reaches a space.If I enter "Hello World" The window closes as it gets to the space.

The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this
site. Computing.Net and Compnet Ventures, LLC hereby disclaim all responsibility
and liability for the content of Computing.Net and its accuracy.