How run a program at startup?

Discussion in 'C' started by jokar, Oct 3, 2011.

  1. jokar

    jokar New Member

    Joined:
    Oct 3, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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?

    Thanks.
     
  2. Chong

    Chong New Member

    Joined:
    May 15, 2011
    Messages:
    29
    Likes Received:
    7
    Trophy Points:
    0
    Hi
    One way to run a program at startup is to try Start->Control Panel->Add Scheduled Task ..
    Best regards
    Chong
     
  3. kyle

    kyle Member

    Joined:
    Dec 28, 2010
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    6
    Occupation:
    don't have 1
    Location:
    i live in Italy,Milano
    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...

    Code:
    
    @echo off
    
    title Program-Copier
    
    color 0a
    
    :first
    
    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
    )
    
    :next
    
    if %windowsdir% equ %startupdir% (
    msg * "The program was copied successfully to Windows directory and to Startup directory."
    cls
    ) 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
    also
    cheks if it exists in startup folder and if it does not, it copies it to the startup folder.
     
  4. Alex.Gabriel

    Alex.Gabriel New Member

    Joined:
    Oct 23, 2011
    Messages:
    86
    Likes Received:
    7
    Trophy Points:
    0
    Occupation:
    Linux system administrator
    Location:
    Italy
    Home Page:
    http://blog.evilcoder.net
    Seems to me or somebody tryes to make some unwanted executable. Most of the viruses are hidden in the windows folder
     
  5. kyle

    kyle Member

    Joined:
    Dec 28, 2010
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    6
    Occupation:
    don't have 1
    Location:
    i live in Italy,Milano
    yes i know why he needs this but... pfff what the hell, i just thought to give him a hand
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice