Problems With User Creation Script

Hello everyone,

I've been attempting to make a program which creates user accounts from a file which contains the usernames required. It also checks if the directory of the username exists in the C:\Users directory and then is going to give the option to delete the directory, or rename it, this is the code I have so far (not finished, using echo's for test purposes):

@ECHO OFF
GOTO USERADD

:USERADD 
	FOR /F %%i IN (C:\Users\Charlie\Documents\Usernames.txt) DO IF EXIST C:\Users\%%i (
											    SET /P deleteorkeep="This username %%i already exists, press d to delete the account and files, press k to delete the account but rename the files folder with a suffix of _old:" 
										            
											    IF /i "%deleteorkeep:~,1%" EQU "d" (
											     	ECHO delete
											   )

											    IF /i "%deleteorkeep:~,1%" EQU "k" (
												ECHO keep
											   ) ELSE (
											      NET USER %%i %%i /add
											   )
)

The problem I'm having is that when I type either 'k' or 'd' the echo output is often incorrect (the script echo's keep, when I've pressed d). I have no idea what the problem is as I'm relatively new to batch scripting, so I need someone's help!

Thanks in advance

it is a problem of parenthesis positionning :

@echo off
 SET /P deleteorkeep="This username %%i already exists, press d to delete the account and files, press k to delete the account but rename the files folder with a suffix of _old:" 
IF /i "%deleteorkeep:~,1%" EQU "d" (      ECHO delete    )
   IF /i "%deleteorkeep:~,1%" EQU "k" (   ECHO keep     
   ) ELSE (     
   NET USER %%i %%i /add     )