ns870152 Posted September 30, 2013 Share Posted September 30, 2013 (edited) Example: I have a file *.reg with content: [HKEY_LOCAL_MACHINE\SOFTWARE\Program name] "Path"="D:\\Program name\\" If I move "Program name" to E: I must edit: [HKEY_LOCAL_MACHINE\SOFTWARE\Program name] "Path"="E:\\Program name\\" How to auto insert the correct/current path without changing the reg file ? Thank you in advance Edited September 30, 2013 by ns870152 Quote Link to comment Share on other sites More sharing options...
Dodel Posted September 30, 2013 Share Posted September 30, 2013 Could you not make it portable, using something like thinstall app or similar, (That way it's always looking for it's *root*\\path.) Quote Link to comment Share on other sites More sharing options...
Kalju Posted September 30, 2013 Share Posted September 30, 2013 This is a very interesting question. And the answer is that it is always automatically amended. If not, then there is something wrong with Yours system. Quote Link to comment Share on other sites More sharing options...
ns870152 Posted September 30, 2013 Author Share Posted September 30, 2013 Could you not make it portable, using something like thinstall app or similar, (That way it's always looking for it's *root*\\path.)Thank you Some softwares can't be made portables by Thinapps, Cameyo, SpoonStudio... for PES game, I can use the path: "installdir"=".\\", I can copy it everywhere without problem in a bat file, I can use %~dp0 to get current path but in a reg file, I don't know... Quote Link to comment Share on other sites More sharing options...
Dodel Posted September 30, 2013 Share Posted September 30, 2013 (edited) Could you not make it portable, using something like thinstall app or similar, (That way it's always looking for it's *root*\\path.)Thank youSome softwares can't be made portables by Thinapps, Cameyo, SpoonStudio...for PES game, I can use the path: "installdir"=".\\", I can copy it everywhere without problemin a bat file, I can use %~dp0 to get current path but in a reg file, I don't know...Sorry for the quick, basic replies (I'm posting from work), without fully understanding what you're trying to do, I can only partially guess. Anyhow you can use :-[%SystemRoot]in a reg key for the local install path. (If I'm going along the right lines.)RegardsDodel. Edited September 30, 2013 by Dodel Quote Link to comment Share on other sites More sharing options...
ns870152 Posted September 30, 2013 Author Share Posted September 30, 2013 (edited) Example: To open (association) a DOC file with Word 2003 portable, I use a bat file (in Office 2003 folder) with content: assoc .doc=Word ftype Word="%~dp0Microsoft Office Word 2003.exe" "%%1" I can copy Office 2003 folder to everywhere, the bat file is still right working because %~dp0 is the current path where the bat is in I want to do the same with a Reg file Sorry for my ugly explaination Edited September 30, 2013 by ns870152 Quote Link to comment Share on other sites More sharing options...
Dodel Posted September 30, 2013 Share Posted September 30, 2013 http://sourceforge.net/projects/regrapper/Registry Rapper is a template for allowing the use of programs that save their settings to the registry as portable applications.Possibly worth a go. Quote Link to comment Share on other sites More sharing options...
ns870152 Posted September 30, 2013 Author Share Posted September 30, 2013 (edited) http://sourceforge.net/projects/regrapper/ Possibly worth a go.Thank you but this tool requires editing the path of program in INI and REG file Edited September 30, 2013 by ns870152 Quote Link to comment Share on other sites More sharing options...
MasterZeus Posted September 30, 2013 Share Posted September 30, 2013 (edited) Here is Your Solution :)@echo offecho [HKEY_LOCAL_MACHINE\SOFTWARE\Program name] 2>&1 > myReg.regset CUR_DIR=%~dp0set NEW_PATH=%CUR_DIR:\=\\%echo."Path"="%NEW_PATH%" 2>&1 >> myReg.reg Edited September 30, 2013 by MasterZeus Quote Link to comment Share on other sites More sharing options...
ns870152 Posted September 30, 2013 Author Share Posted September 30, 2013 (edited) Here is Your Solution :)Thank you, but the code replace all keys of the reg Here exact the REG I want to do: REGEDIT4 [HKEY_LOCAL_MACHINE\SOFTWARE\Labcenter Electronics] [HKEY_LOCAL_MACHINE\SOFTWARE\Labcenter Electronics\Licences 1.1] [HKEY_LOCAL_MACHINE\SOFTWARE\Labcenter Electronics\Licences 1.1\Professional] (...) [HKEY_LOCAL_MACHINE\SOFTWARE\Labcenter Electronics\Proteus 8 Professional] "Path"="D:\\Electronics\\Proteus8\\" "Version"="8.0.15417.0" "ProgramData"="D:\\Electronics\\Proteus8\\Data\\" "LicenceFamily"="Professional" "Product"="Proteus Professional" [HKEY_LOCAL_MACHINE\SOFTWARE\Labcenter Electronics\Proteus 8 Professional\Update Manager] "UpdateSchedule"=dword:00000007 [HKEY_LOCAL_MACHINE\SOFTWARE\Labcenter Electronics\Proteus Professional] [HKEY_LOCAL_MACHINE\SOFTWARE\Labcenter Electronics\Proteus Professional\7] "UpdateFrequency"=dword:00000003 D:\\Electronics\\Proteus8\\ is the path auto replaced (as a variable) when I (or my friends who shared) don't copy to right to this location Edited September 30, 2013 by ns870152 Quote Link to comment Share on other sites More sharing options...
MasterZeus Posted October 1, 2013 Share Posted October 1, 2013 (edited) Solution 1: 1) Add All Registry Entry From 1st reg File (applicationReg.reg <-- [Your Current reg File As it is]) 2)Updated Path From 2nd reg File (newPath.reg) @echo offSETLOCAL ENABLEDELAYEDEXPANSIONreg import applicationReg.regecho REGEDIT4 2>&1 > newPath.regecho. 2>&1 >> newPath.regecho [HKEY_LOCAL_MACHINE\SOFTWARE\Labcenter Electronics\Proteus 8 Professional] 2>&1 >> newPath.regset CUR_DIR=%~dp0set NEW_PATH=%CUR_DIR:\=\\%echo."Path"="%NEW_PATH%" 2>&1 >> newPath.regecho."ProgramData"="%NEW_PATH%Data\\" 2>&1 >> newPath.regreg import newPath.reg Edited October 1, 2013 by MasterZeus Quote Link to comment Share on other sites More sharing options...
MasterZeus Posted October 1, 2013 Share Posted October 1, 2013 (edited) Solution 2: 1) Add All Registry Entry From reg File (applicationReg.reg <-- [Your Current reg File As it is]) 2)Updated Path Directly To The Registry @echo offSETLOCAL ENABLEDELAYEDEXPANSIONreg import applicationReg.regset CUR_DIR=%~dp0REG ADD "HKLM\Software\Labcenter Electronics\Proteus 8 Professional" /f /v Path /t REG_SZ /d "%CUR_DIR%REG ADD "HKLM\Software\Labcenter Electronics\Proteus 8 Professional" /f /v ProgramData /t REG_SZ /d "%CUR_DIR%Data\ Edited October 1, 2013 by MasterZeus Quote Link to comment Share on other sites More sharing options...
MasterZeus Posted October 1, 2013 Share Posted October 1, 2013 (edited) Solution 3: Directly Update Path to the reg File (applicationReg.reg <-- [Your Current reg File As it is]) @echo offSETLOCAL ENABLEDELAYEDEXPANSIONset cur_path=%~dp0set cur_path=%cur_path:\=\\%FOR /F "tokens=1,* delims==" %%A in ('type applicationReg.reg') do (set line=%%Bif defined line ( if %%A == "Path" ( echo %%A="%cur_path%" 2>&1 >> newPath.reg )else if %%A == "ProgramData" (echo %%A="%cur_path%Data\\" 2>&1 >> newPath.reg ) else echo.%%A=%%B 2>&1 >> newPath.reg) else (echo.%%A 2>&1 >> newPath.reg echo. 2>&1 >> newPath.reg ) )del /F applicationReg.regren newPath.reg applicationReg.reg Edited October 1, 2013 by MasterZeus Quote Link to comment Share on other sites More sharing options...
ns870152 Posted October 1, 2013 Author Share Posted October 1, 2013 (edited) @MasterZeus: Thank you very muchIs there any solution for only reg file without using bat file ?Some games/softwares are packed by WinRAR allow changing the install path and importing correct path to registry. How does it do ? Edited October 1, 2013 by ns870152 Quote Link to comment Share on other sites More sharing options...
MasterZeus Posted October 1, 2013 Share Posted October 1, 2013 @MasterZeus: Thank you very muchIs there any solution for only reg file without using bat file ?Some games/softwares are packed by WinRAR allow changing the install path and importing correct path to registry. How does it do ?Don't Know About But i Think They Run Some POST Installation Script To Update Path in Registry. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.