Start Program Automatically after Windows XP boot

I'm setting up a couple of PC's that will access software on a server via Terminal Services.   I would like to completely automate this process, i.e., Push the Start button on the case, boot up, automatically use a predetermined remote desktop connection (with credentials to logon to the server) and reach the login screen for the software that I want to access - without end user intervention.  When the end user has finished working and logs out of the software, I would like for the client pc to shut down automatically.
Who is Participating?
Heathcliff74Connect With a Mentor Commented:
To break the cycle, I think there are 2 possibilities.
1. After the reboot, hit F8 and run safe mode. The batch-file will not run. You can remove or edit the batch-file from safe-mode and then boot normally again.
2. Minimize the remote-desktop screen, by hovering your mouse to the top-middle of the screen and wait for the yellow bar to appear and click minimize (not close, because then the batch-file will continue to shut-down). Then close the command-prompt window. This will break the batch-file. Then you can close the remote-desktop without the shutdown.

The "cannot find the file specified" probably means that the "sleep.exe" is not in the location you specified in the batch file. Verify the path and any type-errors in the batch-file.

I think you can only modify the size of the command-prompt by moving the batch-file to another location. Then put a shortcut to the batch-file in the Startup-folder. Then open the properties of the shortcut. Then under the layout-tab you can enter the window-size in characters. You have to try, which size is best for you. Alternatively, you could remove all icons from the desktop, since these are never meant to be used anyway.
Open the remote desktop client. Fill in the destination and credentials if you wish. Then click "Save as" and save the rdp-file to an accessible location (for example: C:\Auto.rdp)

Create a batch file and copy these commands In it:

%systemroot%\system32\mstsc.exe "C:\Auto.rdp"
%systemroot%\System32\Shutdown -s -t 00

Make sure the path to the rdp-file in the batch-file is the same as the location where you saved the rdp-file.

Copy the new batch file to your startup folder of the current user:
%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\

OR to the startup-folder for all users:
%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Startup\

That should do it.
baleman2Author Commented:
One question.  In order to do maintenance on the client at such time as I may need to do so - how will I be able to reach the Windows desktop INSTEAD of immediately logging on to the server?
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Download the "Windows Server 2003 Resource Kit Tools" here:
Install it. Then add this at the beginning of your batch-file:

@echo "Starting remote desktop in 5 secs. Press CTRL-C to cancel!"
@C:\Program Files\Windows Resource Kits\Tools\Sleep.exe 5

Make sure the path to Sleep.exe matches the path where you installed the tools. If you press CTRL-C you will be asked to terminate the batch-job. If you confirm with "Y" the remote desktop will not start.
baleman2Author Commented:
Will attempt today and report ASAP.
baleman2Author Commented:
Sorry to be so late reporting results.  Am very satisfied because the pc does "boot" and move straight to the login screen of the server. . . and shuts down upon exit.  However, after the batch file begins to run the command:

@echo "Starting remote desktop in 5 secs. Press CTRL-C to cancel!" , this appears directly beneath:

So, I'm currently "locked" into booting straight to the server - can't stop the process.

Also, can the "command prompt" window (where the batch file commands appear) run in full-screen?

The Windows desktop appears behind it now.  This is going to lend itself to the "end user" trying to click on icons before the login to the server completes.
baleman2Author Commented:
HeathCliff74 - This is what I call SUPPORT!!!!!   Every step was clear, concise, and absolutely accurate.  You COMPLETELY solved my problems.  Thanks so much!
Glad I could help. Good luck!
baleman2Author Commented:
One addendum if I may:
I have two of these pc's "autologging" in the same office.  The two are in their own small workgroup so as not to interfere with a larger LAN in the same building.  Only one of these two pc's has a printer (HP p2015 laserjet) connected to it via USB cable. . . and it is shared.  The 2nd PC has it installed as a "network" printer.  Would the "autologging" process have anything to do with the 2nd PC "not" being able to print to the shared printer on the 1st pc?
The autologon should not interfere. When you cancel the logon to the remote desktop, can you use the network printer from the local desktop?

If so then you should probably edit the rdp-file you saved for the autologon. Open the remote desktop client, expand the "options", click open and select the rdp-file. Go to the local-resources-tab and check the option "Printers". Go back to the general-tab and click save. That should bring the network-printer to your remote-desktop. Alternatively you could try to add the printer as a network-printer within the remote desktop.

If you are not able to use the printer from your local desktop, then that would be a different problem and most probably not related to the autologon or remote desktop.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.