Batch registry key

Questions about programming languages and debugging
Post Reply
User avatar
killzone
suck-o-fied!
suck-o-fied!
Posts: 55
Joined: 28 Dec 2006, 17:00
17
Location: Michigan USA
Contact:

Batch registry key

Post by killzone »

I am trying to code a batch file that will create a new batch file and then copy that file to a new registry key so that it will run at startup. This way one will only have to run the file once and then afterwards the desired function of the newly created file will be executed automatically at startup leaving no use for the original. This would be for people with little coputer skills, it would allow them to run my file and that file would do the work no techinal knowledge required. I run a computer service so this would be perfect for my customers. Any ideas on this in batch?

User avatar
floodhound2
∑lectronic counselor
∑lectronic counselor
Posts: 2117
Joined: 03 Sep 2006, 16:00
17
Location: 127.0.0.1
Contact:

Post by floodhound2 »

This was covered a few months ago. Try looking or searching for the post. If you can not find it ill help you code this. Actually it is quite fun and easy to do if you try a little. I don’t want to tell you how to do it so easily.

:wink:

PEACE
₣£ΘΘĐĦΘŮŇĐ

User avatar
killzone
suck-o-fied!
suck-o-fied!
Posts: 55
Joined: 28 Dec 2006, 17:00
17
Location: Michigan USA
Contact:

thanks

Post by killzone »

i looked in the forums and all i could find was this idiot snapson101's post who seemed like a real idiot and blew up at u. but i couldnt really find an answer in that post. it just detailed how to make a program that would open a whole bunch of command prompts. I am pretty new to batch so could you please help me? it may be easy but i dont know the command or syntax for it. thanks

User avatar
floodhound2
∑lectronic counselor
∑lectronic counselor
Posts: 2117
Joined: 03 Sep 2006, 16:00
17
Location: 127.0.0.1
Contact:

Post by floodhound2 »

All right ill post the code here tomorrow while I am at work. I made a batch file that copies it self and runs at startup in the registry. Might be real close to what you need. At least it will get you going in the right direction. Gogeta70 is the code man here so when he sees this he can help you more.

In the mean time if you have time do some batch commands in notepad. like [ command, notepad, calc, then get creative and see what you can do.] save your program as a .bat file

PEACE
₣£ΘΘĐĦΘŮŇĐ

User avatar
killzone
suck-o-fied!
suck-o-fied!
Posts: 55
Joined: 28 Dec 2006, 17:00
17
Location: Michigan USA
Contact:

Post by killzone »

thanks

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Post by Gogeta70 »

Well... I'm not exactly sure what you want, all i can say is to read up on MS-DOS commands, because that's all a batch file is. Usually, you want to start a batch file with

"@echo off" so that the program simply runs, without telling you what it's doing.

Some useful commands are here:

Echo
Pause
Color
Title
Copy
Md
Del
Deltree
>> - used with "echo" ... copies information to a file

for instance, "Echo hello > hello.txt" will create the file hello.txt, then add the word "hello" to it. using >> appends to an existing file, or creates a new one otherwise.

Again, read up on MS-DOS commands and you should be good to go.
¯\_(ツ)_/¯ It works on my machine...

User avatar
sternbildchen
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 421
Joined: 26 Apr 2006, 16:00
17
Location: Germany

Post by sternbildchen »

Write this in the batch file for the registry:

Code: Select all

reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v MyEntryNameInTheReg /t REG_SZ /d c:\wherEever\whereEver\MyProgramm.exe 
And use gogeta's code to write the new bat file:

Code: Select all

Echo MyNewBatchCode > c:\MyNewFile.bat
Happy Viri writing. :P

User avatar
killzone
suck-o-fied!
suck-o-fied!
Posts: 55
Joined: 28 Dec 2006, 17:00
17
Location: Michigan USA
Contact:

thanks

Post by killzone »

awesome guys thanks alot

User avatar
killzone
suck-o-fied!
suck-o-fied!
Posts: 55
Joined: 28 Dec 2006, 17:00
17
Location: Michigan USA
Contact:

Post by killzone »

wait up sternbildchen that little bit of code will add a regitry key and that registry key will call on the created file and run it everytime at startup? cause it did not work for me this is the code i used

@echo off
echo @echo off >> test.bat
echo echo test >> test.bat
echo pause >> test.bat
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v test /t REG_SZ /d c:\Documents and Settings\Beastliness\Desktop\test.bat

when i rebooted my comp to see if it worked nothing happened

User avatar
sternbildchen
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 421
Joined: 26 Apr 2006, 16:00
17
Location: Germany

Post by sternbildchen »

Code: Select all

@echo off 
echo @echo off > c:\test.bat 
echo echo test > c:\test.bat 
echo pause > c:\test.bat 
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v test /t REG_SZ /d c:\test.bat
try this, haven't tested it but I think it works.

/edit: Works 100%

User avatar
killzone
suck-o-fied!
suck-o-fied!
Posts: 55
Joined: 28 Dec 2006, 17:00
17
Location: Michigan USA
Contact:

thanks

Post by killzone »

thanks alot guys just one more small question is there a command that will open another file i tried call and open but the batch file said no such command exists. :D

User avatar
sternbildchen
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 421
Joined: 26 Apr 2006, 16:00
17
Location: Germany

Post by sternbildchen »

What aboud thinking for yourself ... You can't have everything done by others. :(

Never started a programm in dos prompt ? ...

User avatar
RNA
suck-o-fied!
suck-o-fied!
Posts: 95
Joined: 23 Nov 2006, 17:00
17
Location: A bit to the right of null
Contact:

Re: thanks

Post by RNA »

killzone wrote:thanks alot guys just one more small question is there a command that will open another file i tried call and open but the batch file said no such command exists. :D
Just to post something helpful.
If you mean run another program you would do it simply by

Code: Select all

C:\MyAppFolder\MyApp.exe 
same for sending an application arguments

Code: Select all

C:\MyAppFolder\MyApp.exe SomeArg SomeotherArg

Post Reply