Adding an exe to start-up using batch
batch-file, exe, startup, windows, windows-7
Solution
You are trying to control the list of applications that are started when a user logs on. The keys that determine that are:
HKLM\Software\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
Use the former to control applications started when any user logs on. Use the latter to control applications started when the current user logs on.
You want to do this in a batch file. So you need to use the standard tools for controlling registry keys. That means the `reg` tool.
So, add a value like this:
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v MyApp /d myapp.exe
And remove the value like this:
reg delete HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v MyApp
If you want to use `HKCU` rather than `HKLM` then change the key appropriately. Obviously if you choose to use `HKLM` that will require elevation.
Do be prepared for the fact that many virus scanners will treat such activity as evidence that your program is malicious.
Problem
Need a batch file that can add and remove a .exe file from the start-up. Does any one know ho I could do it. When I say start-up I mean the exe executes when The user log's on. I am compileing the batch file with http://www.battoexeconverter.com/.