Forums: Registry Entrys In Batch - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Registry Entrys In Batch

#1 User is offline   toe 

  • Staff Sergeant
  • Icon
  • Group: Members
  • Posts: 271
  • Joined: 10-November 04

Posted 09 June 2005 - 06:40 PM

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
0

#2 Guest_Necrocide_*

  • Group: Guests

Posted 09 June 2005 - 10:43 PM

Maybe something like;

="\"somefilename.exe %1\" %*"


:)
0

#3 User is offline   KarachiKing555 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 103
  • Joined: 09-October 03

Posted 09 June 2005 - 10:59 PM

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
0

#4 Guest_Paul_*

  • Group: Guests

Posted 10 June 2005 - 01: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.
0

#5 User is offline   Hybr!d 

  • Private
  • Icon
  • Group: Members
  • Posts: 13
  • Joined: 14-June 05

Posted 14 June 2005 - 10:20 PM

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..
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

  • Share



Our Sponsors:


SwiftLayer Affiliate Web Hosting