Windows XP startup question

Hi,

I'm writing a program that I'd like to have started every time that Windows powers up.

I tried putting it as the last thing in autoexec.bat... no luck.

I added it to the Windows control panel/scheduled tasks thing, and it sure looks like I've set it up to run at startup. But it doesn't.

The program is a console-mode utility that I'm using just to test the startup mechanism. It should pop a window open on my desktop, or at least appear in the tray.

Any ideas?

John

Reply to
John Larkin
Loading thread data ...

Copy/drag a shortcut to the program into the following directory?

C:\Documents and Settings\All Users\Start Menu\Programs\Startup

Reply to
Greegor

That works! Thanks.

I wonder why the official Windows thing doesn't.

John

Reply to
John Larkin

Sigh. Because it's "the official Windows thing".

There's something broken on this laptop I got for $5 at a yard sale; it runs XP Home SP1 and can't update; the necessary ActiveX controls will not run no matter what I do.

OTOH it boots faster than any other machine in the house, and is fine for general browsing, email, and usenet, so I'm in no hurry to fix it.

Mark L. Fergerson

Reply to
alien8752

You're welcome!

Reply to
Greegor

Startup is the easiest way. You can put a shortcut to a batch file there. It will start up with the owner as the user who logs on.

To have the system own it, and have it start up always, you can add it into the registry (also makes it more invisible). Should be a matter of creating a text file ending in .reg and then merging it with a right click or double click.

Probably easiest to export an existing key, edit it, then enter it back in.

HKLM/Software/Microsoft/Windows/Current Version/Run has about 15 keys in one computer here with things like iTunesHelper, the firewall, and the Analog Devices sound controller(s).

Here is a valid .reg file (the parts between the --):

-- Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] "iTunesHelper"="\"C:\\Program Files\\iTunes\\iTunesHelper.exe\""
--
Replace the name with whatever you like and point the path to your
program and any parameters and I think it will work. Use \" as the
escape sequence for embedding " and \\ to embed \. 

Be careful with registry modifications, apparently some people manage
to screw up their computers royally, though I've done hundreds of
changes with worst case effect that some piece of software has to be
re-installed. 

There's a similar setting under HKEY_CURRENT_USER. 

Also, both have RUN_ONCE, if that's what you need to do. 


Best regards, 
Spehro Pefhany
Reply to
Spehro Pefhany

How did you start it as a service, directly or by using SrvAny ?

Reply to
Paul Keinanen

One thing to bear in mind with modern (NT-based) Windows which didn't apply to older (DOS-based) versions: the distinction between startup and login.

When the machine boots, no-one is logged in. You can run services in this state, but there's no desktop or current user, so anything which assumes that there is won't work.

You can configure programs to run when a user logs in (either a specific user or any user) via registry keys, e.g.:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run or: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run

However, some relatively important desktop services are also run via these keys, and there's no guarantee that they will have started before any custom programs are run.

Anything in the Startup folder gets started later (once Explorer is up and running), which tends to make it the easiest option if you just want an application to be started whenever you log in.

Either way, one pitfall is that XP and later allow multiple users to be logged in, so you can end up with multiple instances of the program on different desktops, which can confuse programs which weren't written with this in mind.

Reply to
Nobody

My Windows XP registry book tells you exactly where in the registry to do this. There are a number of options, all of which will probably have what you want.

ISBN-13: 978-0782129878

You can probably find a copy at any better library. Or a used book store.

Reply to
PeterD

On a sunny day (Fri, 25 Dec 2009 09:26:04 -0500) it happened PeterD wrote in :

MUCH CHEAPER IS TO BURN YOUR xp DISK AND INSTALL LINUX, STUDY init.

Reply to
Jan Panteltje

"John Larkin" wrote in message news: snipped-for-privacy@4ax.com...

Putting icons in the systray is another set of function calls.

Cheers

Reply to
Martin Riddle

Should have included a link, NotifyIcon Class

Merry Christmas!

Reply to
Martin Riddle

Bummer. This is my cabin automation machine. I want this PC to start up after any power fail and run the automation app. I'd also like guests to be able to run under the "guest" login, not as me/admin.

Windows is garbage. I may have to get an entirely separate pc, maybe a small mini-ITX thing, to run this.

Did I mention that Windows is garbage?

Pity... the hardware is coming right along.

ftp://jjlarkin.lmi.net/Auto_plate.jpg

John

Reply to
John Larkin

Put it in C:\Documents and Settings\All Users\Start Menu\Programs\Startup It'll start for any user.

Cheers

Reply to
Martin Riddle

On a sunny day (Fri, 25 Dec 2009 08:48:27 -0800) it happened John Larkin wrote in :

John, you will also need a hardware watchdog. Even if the OS (whatever type) starts up correctly, it is my experience that sometimes BIOSes do not. That means the PC will stay off after a mains glitch, even if you specify in BIOS that it should restart. Your program should periodically write to some I/O, say a par port or serial port, the hardware should monitor that, and do a mains power sequence if the 'pulse' is not detected. It should also have a max count for the number of restarts, and phone you when that count is reached without a correct restart. I have done a system like that in the eighties, much to my amazement I came in some place some year ago and it was still in full operation there! IIRC I used shift registers for the counter in that time... no micro..

Reply to
Jan Panteltje

I need it to start my app if there a powerfail/restart when nobody is around to log in.

John

Reply to
John Larkin

Checked: this doesn't start my app until a user logs in, and it starts it for all users. That won't work for what I want to do, so I suppose I'll have to hack the registry.

John

Reply to
John Larkin

"John Larkin" wrote in message news: snipped-for-privacy@4ax.com...

Run it as a service? I believe services are started prior to login.

Cheers

Reply to
Martin Riddle

snipped-for-privacy@bid.nes Inscribed thus:

There are a lot of older laptops out there that won't run anything other than SP1.

--
Best Regards:
                     Baron.
Reply to
Baron

If you remove the password and have only one user set up, won't it log on automatically?

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.