Instructables

Create a program to run .bat files?


Hello,

I want to run a .bat file when my computer starts up automatically..
I made a script in wordpad, saved as .bat to try and open the file, but I recieved weird error messages when trying to open the file, the script worked on other things such as opening microsoft word ( I did this to check if it was working)
I would like to know if there is any simple program I could write or download that could open this file (like your clicking it)

Many thanks

Oscar

verence3 years ago
Assuming, you're using Windows (TM)(R) 95/98/ME/2000/NT/XP/Vista/7, just put the Batchfile/Script in the 'Startup'-Folder. Anything in this folder will be executed on system start and Windows knows how to start .bat files. (Technically, the program to 'run' .bat files is cmd.exe (or command.exe depending on the Windows version) but .bat files are already connected to cmd.exe in the Registry).

Try your batch by simply double clicking on it. It should not produce any (unwanted) error messages.

You shouldn't use Wordpad to edit the batch, it might introduce unwanted formatting characters that can't be processed. Use Notepad instead.
oscarthompson (author)  verence3 years ago
Sorry, I didnt word my question correctly. I made it in Notepad.. Unforunatly the .bat is in a folder with files that it needs and cant be moved without an error, The .bat file is used to start a server.

Thanks for your comment

Oscar
In that case, don't put the .bat file itself in the Startup folder, but a link to it and use the properties of the link to make sure, it is executed in the target path.

- You can open the Startup folder by right clicking on the Start button and selecting 'Open' or 'Open all users'. If you select 'Open', it will start only, when you log on, if you select '..all users', it will start for anyone.

- Navigate to 'Program files\Startup'

- Open the an Explorer window with your .bat file.

- Drag your .bat file to the Startup folder with the right mouse button. On release, select 'Create shortcut here'*.

- Right-click the new shortcut and select 'Properties'. Make sure, the 'Execute in' is set to the folder of your .bat file

- Double click the shortcut to test it

- Reboot to test it live.

* The texts may be a bit off, as I translate from my German Windows.
oscarthompson (author)  verence3 years ago
Thanks! It worked!
Nearly Finished automating my server now!..

Oscar
thegeeke3 years ago
You can also google. Bat to. Exe converters or. Bat compilers... they also come in handy sometimes! :)
lemonie3 years ago

Autoexec.bat - look it up.

L
oscarthompson (author)  lemonie3 years ago
Thanks, I'm going to have a look into this!

Oscar