toe
Jun 10 2005, 02:40 AM
How would I make a Program autostart by using a batch to make the reg entry. Ive found some examples but not really what i need to know.
:: Create a temporary .REG file
> "%Temp%.\DefOpen.reg" ECHO REGEDIT4
>>"%Temp%.\DefOpen.reg" ECHO.
>>"%Temp%.\DefOpen.reg"ECHO [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run]
>>"%Temp%.\DefOpen.reg" ECHO @="%_%start note pad"
>>"%Temp%.\DefOpen.reg" ECHO.
>>"%Temp%.\DefOpen.reg" ECHO [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run]
>>"%Temp%.\DefOpen.reg" ECHO @="notepad.exe \"%%1\""
>>"%Temp%.\DefOpen.reg" ECHO.
(note code isnt mine, still learning)
the temp file is loaded to the registry later in the batch file. I really have no idea how the format of writing a reg entry in batch would llook like. I think im kinda on the right path but having problems with the lines that are in bold??? just say i want to run notepad every startup.
-toe
Necrocide
Jun 10 2005, 06:43 AM
Maybe something like;
CODE
="\"somefilename.exe %1\" %*"
KarachiKing555
Jun 10 2005, 06:59 AM
I think u can't use Variables to make Regs for non NT's coz %temp% will returen c:\windows\temp but to be add added in registry it shoud be "c:\\windows\\temp" use some third party software the one i saw on nirsoft.net called nircmd.exe...
and it shoud be like this if u still wana use bat or reg:
ECHO REGEDIT4>>c:\\DefOpen.reg"
NOT
> "%Temp%.\DefOpen.reg" ECHO REGEDIT4
Paul
Jun 10 2005, 09:05 AM
if %temp%==c:\windows\temp (
echo "c:\\windows\\temp" >> tosomewhere
) else (
echo "c:\\winnt\\temp" >> tosomewhere
)
Also, if you want to run notepad every time windows start you should notice the key where to put it @ registery.
You can make notepad run if some other program is started either, by adding a "extension" in the registery.
Hybr!d
Jun 15 2005, 06:20 AM
Well this is .reg file way and i included the .bat file way too..
If you want notepad or any other program to run when you open windows or enter it all you got to do is:
Open notepad and paste this script into it
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run]
"Notepad"="C:\WINDOWS\notepad.exe"
Thats all and then save the notepad file as .reg and run it. The program should run always now.
-----------------------------------------------------------------------------------------------
Now for the batch file way this is the script you need
@echo off
SET KEY=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
REG ADD %KEY% /V Notepad /D "%systemdrive%\WINDOWS\notepad.exe" /f
exit
Put this in notepad and save as .bat and run it. Everything should work fine..
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.