Home > Mobile >  How to create a program that can rename an exe in program files and rename a folder in Windows regis
How to create a program that can rename an exe in program files and rename a folder in Windows regis

Time:10-31

I'm new in this stuff! As far as I know when you install a program, the installer creates a folder in C:\Program Files with the contents of the application, and a folder appears in the windows registry with values it needs to work. I would like to create something like that that can rename an exe and rename a windows registry folder.

I already know how to rename an .exe with a .bat in the same folder:

@pushd "%~dp0" >nul 2>&1
@echo off
title Instalador
ren "Program1.exe" "Program2.exe"
@exit

And I tried using this line and opened regedit but idk how to change a folder's name with a command (for example renaming HKEY_LOCAL_MACHINE\SOFTWARE\Program1 to HKEY_LOCAL_MACHINE\SOFTWARE\Program2)

C:\Windows\regedit.exe

CodePudding user response:

there is no rename command in regedit command line. all you can do is copy it to new name and then remove old one:

@echo off
echo Copying Program1 to Program2
ren path\to\program1.exe path\to\program2.exe
reg copy HKEY_LOCAL_MACHINE\SOFTWARE\Program1  HKEY_LOCAL_MACHINE\SOFTWARE\Program2 /s /f
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Program1 /f

/s means Copies all subkeys and values

/f means Forces the operation without prompt.

  • Related