Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   How run a program at startup? (http://www.go4expert.com/forums/run-program-startup-t26837/)

jokar 3Oct2011 17:56

How run a program at startup?
Hello all.
i write a program and want change windows registry for rum my program at startup,what should i do?

i wanna my program copied to the windows directory too ,can you show me some code?


Chong 29Oct2011 12:07

Re: How run a program at startup?
One way to run a program at startup is to try Start->Control Panel->Add Scheduled Task ..
Best regards

kyle 29Oct2011 16:42

Re: How run a program at startup?
if you have already wrote the program or you have the program, it's very simple...
one way is to manually create a shortcut of the program and paste it into the startup folder in Start ==> All Programs ==> Startup and to copy the program to windows directory manually
or you could try this...


@echo off

title Program-Copier

color 0a


set dirvar=windowsdir

set dirvar1=startupdir

if exist "C:\Windows\program-name.extinson". (
set %dirvar%==1
) else (
copy "drive:\program-path\program-name.extinsion" "C:\Windows"
set %dirvar%==1

if exist "%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\startup\program-name.extinsion". (
set %dirvar1%==1
) else (
copy "C:\Windows\program-name.extinsion" "%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\"
set %dirvar1%==1


if %windowsdir% equ %startupdir% (
msg * "The program was copied successfully to Windows directory and to Startup directory."
) else (
msg * "The program was not copied successfully in Windows directory or Startup directory."
goto :first

before saving this you should change some things
first copy the code to notepad and do the following...

ctrl + h
find what: program-name.extinsion
replace with: your programs name with the extinsion
another replacement
ctrl + h
find what: drive:\program-path
replace with: your programs full location path. example "C:\programs\myprogram-folder\"
Warning The path must end with a backslash "\" and it does not include the program name !

Warning Do not remove any double-quotes or dots just replace the sentences !

save it as program-mover.bat in whatever location you want
remember this works in Windows 7 only for another version just comment to create another one

This would see if your program exists in the windows directory and if it does not it copies it to the windows directory
cheks if it exists in startup folder and if it does not, it copies it to the startup folder.

Alex.Gabriel 29Oct2011 17:00

Re: How run a program at startup?
Seems to me or somebody tryes to make some unwanted executable. Most of the viruses are hidden in the windows folder

kyle 29Oct2011 17:10

Re: How run a program at startup?
yes i know why he needs this but... pfff what the hell, i just thought to give him a hand

All times are GMT +5.5. The time now is 12:47.