As you have already heard there is no need to elevate the script; so that part can be removed. I have no information about your Format.exe executable so cannot say for sure if that line is okay but would suggest you try running it without call. When checking if a directory exists, make sure you include a trailing back slash. There is no need to call :RunOnceEx, the increment can be done directly in that for loop. This would be your file after those changes: Code: @echo off setlocal EnableExtensions setlocal EnableDelayedExpansion "%WINDIR%\Setup\Files\Format.exe" set /a KEYNUM=1 SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx REG ADD %KEY% /V TITLE /D "Windows Programlarinizi Yukluyor..." /f FOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST "%%i:\Software\" (for /f "delims=" %%z in ('dir /b %%i:\Software\*.exe') do ( set /a KEYNUM+=1 REG ADD %KEY%\!KEYNUM! /VE /D "%%~nz" /f REG ADD %KEY%\!KEYNUM! /V 1 /D "%%i:\Software\%%z" )) RMDIR /S /Q "%~dp0" exit There are other changes you can make to the above script but none of them should affect it's ability to do what you need it to do. Tip Other than the Format.exe and RMDIR lines every other line can be run in your live system, you only need to check your registry to find out if your for loop works before deleting those entries.