Auto launch on Windows OS Load

This is a discussion on Auto launch on Windows OS Load within the C++ Programming forums, part of the General Programming Boards category; how do i get my program to automatically launch when the windows loads. for example msn has this option and ...

  1. #1
    Registered User
    Join Date
    Jun 2007
    Location
    UK
    Posts
    22

    Question Auto launch on Windows OS Load

    how do i get my program to automatically launch when the windows loads.

    for example msn has this option and lots of other chat programs

    i heard i have to edit a file called autoexec.bat
    where is this file?

    im new to programming if i edit this file badly is it gunna mess up my pc?,
    should i leave it alone?
    Last edited by DDAZZA; 06-11-2007 at 02:05 PM. Reason: changed title

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Do not edit autoexec.bat if you're on Windows XP. This is for the older Windows operating systems that were more DOS-based.

    To get a program to start up automatically for Windows XP, you need to edit the registry. If you are not familiar with this, you could very well break something important. Make sure you know what you're doing.

  3. #3
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Why not add the shortcut in the startup folder of your start menu?

  4. #4
    Registered User
    Join Date
    Jun 2007
    Location
    UK
    Posts
    22
    ty

    ok i dont want to edit the file beacuse i dont know what im doing lol


    well creating the shortcut would be fine BUT
    i have the same problem which is in my other thread, i cant get the Active username

    C:\Documents and Settings\THIS_BIT_HERE\Start Menu\Programs\Startup

    to find the user name the guys in the other thread say to use the Getusername() command but to use this i need to include windows.h but with visual C++ it says it doesnt exsist

    how to i create a shortcut?

  5. #5
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    heard i have to edit a file called autoexec.bat
    You used to. Like in 1992.

  6. #6
    Registered User
    Join Date
    Jun 2007
    Location
    UK
    Posts
    22
    lol well theres some old stuff on the internet

  7. #7
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    C:\Documents and Settings\All Users\Start Menu\Programs\Startup
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  8. #8
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267
    Quote Originally Posted by vart
    C:\Documents and Settings\All Users\Start Menu\Programs\Startup
    How do you know that the person running the program would have his OS installed on C?

    OS: Windows 7, XUbuntu 11.10, Arch Linux
    IDE: CodeBlocks
    Compiler: GCC

  9. #9
    Massively Single Player AverageSoftware's Avatar
    Join Date
    May 2007
    Location
    Buffalo, NY
    Posts
    141
    Quote Originally Posted by h_howee View Post
    How do you know that the person running the program would have his OS installed on C?
    Indeed. This is never a safe assumption.

    Environment variables are the correct answer.

    getenv("HOMEPATH") will get you the current user's home directory.
    getenv("ALLUSERSPROFILE") will get the All Users directory.


    However, I certainly hope you have a good reason for wanting to do this. In general start-up programs are extremely annoying. I know I would be very upset if some program I ran decided that it needed to alter the start-up programs, and this is really way too easy to get away with on Windows.
    There is no greater sign that a computing technology is worthless than the association of the word "solution" with it.

  10. #10
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,854
    You're not the only one, given the subject matter of the first post which got deleted in pretty short order.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  11. #11
    l2u
    l2u is offline
    Registered User
    Join Date
    May 2006
    Posts
    630
    You can make it work like a service.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to make a windows application
    By crvenkapa in forum C++ Programming
    Replies: 3
    Last Post: 03-26-2007, 10:59 AM
  2. Script errors - bool unrecognized and struct issues
    By ulillillia in forum Windows Programming
    Replies: 10
    Last Post: 12-18-2006, 04:44 AM
  3. compiled under windows, work for mac os?
    By Shadow12345 in forum C++ Programming
    Replies: 1
    Last Post: 05-09-2002, 10:55 AM
  4. Printing and DOS within Windows OS
    By kes103 in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 04-03-2002, 08:42 PM
  5. Copying Windows (not the os)
    By DutchStud in forum Windows Programming
    Replies: 5
    Last Post: 11-02-2001, 07:05 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21