How-to: Use batch files to create a working environment

Difficulty: 3


Have you ever noticed that when you get started on a particular task on your computer, you always open up the same bundle of programs to do it? Why not make it easier for yourself and get all of these programs loading up when you want them, with a single click. The answer is batch files.

Batch files have been around longer than Windows has, but sadly they have been forgotten over the years. Generally, DOS is not a nice environment to work in compared to the graphical operating systems we have these days. I feel batch files still have their place. They are very simple to create and they can be edited easily.

You may have already set up your computer to automatically launch particular programs as part of your computers start up sequence. While this will work, it is not really the ideal situation, because you may not be ready to use the programs straight away. This can slightly slow you down or clutter your workspace, for no good reason. Instead, if you use batch files, your specified programs will launch simultaneously with one click, only when you’re ready to use them.

In this article we will look at how to create some basic batch files which you can alter to suit your own needs. For this How-to article, I am going to use batch files to launch environments, e.g. turning your computer into a multimedia heaven. 

When I first thought about this article, I was thinking of a particular scenario I suffer with. I am sure there are a number of similar scenarios where a batch file can help. Take note of excessive clicking and ask yourself if you could automate the clicks by creating your own batch file.

Batch files will help to free up the machines power to launch programs. Computers have the power to load up multiple programs in the same time it takes you to get through the start menu, and click on one of the programs you want. With batch files, you can be up and running within seconds instead of a few minutes.

If you like where this article is heading, create a folder somewhere on your computer to put your batch files into, as you will probably make a few of them. Batch files won’t allow for the icon to be changed, so we need to make shortcuts to them, and then you can change the icon of the shortcut.

Open up Notepad and click “Save As”. You can name the file anything you want, but ensure you change the view to “all files”, and put a .bat on end of the file, e.g. multimedia.bat 

A few examples of what a batch file can do:

Load up a Program

We can use a batch file to load up any application or utility we might need to do a set task.

The command line to open up Winamp from the command line is:

Start "" "C:\Program Files\Winamp\winamp.exe"

You can find the path of most programs by navigating through the start menu to the program you want, right click and select properties. In the dialog that opens up, you should find the path and executable you will need to enter into the batch file.

The hardest thing to remember is the placement of the speech marks.

Load up documents

We are not limited to launching only programs. We can extend batch files to open up documents. This could be useful in all sorts of scenarios. For some people, they work on a particular Excel spreadsheet each day or they want their time-sheet when they get into the office.

This can normally be done by navigating to the folder of the document and then launching the document itself. Windows will look after which program it should open up in as the batch file will use the same defaults that have been built into Windows. The code to do this is below.

Start "" "C:\Documents and Settings\Username\My Documents\document.doc"

This should work for most programs, but if it doesn’t work for you, you may need to launch the program followed by the filename and path. e.g. on a single line, with no text wrapping.

Start "" "C:\Program Files\Microsoft Office\Office12\winword.exe" C:\Documents and Settings.. etc

The first option is desirable as it is quicker.

Load up Websites

As well as launching programs and documents, we are able to launch our browser with a particular website. This could be handy if you want to load a TV guide from a website along with TV viewing software.

The command to make this happen is as below:

Start "" "C:\Program Files\Internet Explorer\iexplore.exe"

Load up an Environment

We can bring together what we have learnt to make a batch file that will load up all the necessary applications and utilities we might need to perform a set task. You can use this to set up an excellent working environment.

If you want to launch multiple programs at once, repeat the above example for each program, document or website, e.g.

Start "" "C:\Program Files\Winamp\winamp.exe"
Start "" "C:\Program Files\TechSmith\SnagIt 8\SnagIt32.exe"
Start "" "C:\Program Files\Microsoft Office\Office12\winword.exe"

This batch file will launch Winamp, SnagIt and MS Word all at the same time.

Some other examples

As everyones needs are different, I don’t want the above examples to be used as “The right way”. Each person needs to examine what will work best for them. Below are some combinations of what is possible to help you come up with a solution that may be right for you.

Keep in mind that batch files are extremely easy to edit, so if it isn’t working for you one way, it is easy to add, remove or edit any line you have previously put into the batch file.

Web Designer – Notepad, Flash, Cold fusion etc
Blogger – SnagIt, BlogJet, Ideas Document and a music player
Gamer – Resolution changer, Game, controller software and volume utility 
Government worker – Solitaire, Hearts, Miniclip, YouTube

Some of these examples are more practical than others, but you get the drift.

A more complex example

The command to launch multiple programs one after another rather than simultaneously, is slightly different to the example above. We need to remove the “start” command so that they don’t launch all at once. This will stop each new line of the batch file loading up automatically. Instead, each step will need to be closed before the next command line can be executed.

When I send my computers video signal over to my TV, I need to drop the resolution, open up Windows Media Center, and when I am finished with Media Center, I need to set the resolution back to it’s original state. The navigation of menus and multiple clicks can instead be reduced to a single execution.

In this example, I am using a utility called ResChange to change my resolution. The utility is completely controlled by the command line, so it is ideal for batch files.

Below is the code I used to make it all happen.

C:\ResChange\reschange.exe -width=640 -height=480 -refresh=60
C:\Reschange\reschange.exe -width=1280 -height=1024 -refresh=max

The first line drops the resolution to 640×480
The second line launches Windows Media Center
The third line changes the resolution back to my Windows default.

I could not use compatibility mode to do this because I also needed to change the refresh rate.

This sequential type of batch file is ideal for a task that requires multiple programs, one after the other; e.g. Ripping a CD, you might rip the music off the CD in one program, convert the file to MP3 in another and then finally edit the tags in a third program. A batch file like this can be used to automatically launch the next step in the process.

There are hundreds of little utilities that we can use to improve our computing experience. Using them around our main programs, means that we don’t need to go through the hassles of manually loading them up.


When loading up an environment where you may occasionally want to load an additional program, you are able to add questions into the batch file. e.g. If you want to load up load up a web browser and email program every time, and sometimes word as well. You can make the batch file open up the web browser and email automatically, and then prompt you to say yes or no to opening up word.

While that sounds nice, it is not really very helpful as it is quicker to load up word with mouse clicks instead of the example shown above. I thought I should mention it in case you wanted to experiment with such features.

We want to use batch files to speed us up and not slow us down, so I won’t go into how you can do this here.


Batch files are not very smart. They do what they are told and they are only really able to execute commands. If you want to use batch files to load up environments, take note that you cannot use batch files to unload environments. Each program will need to be manually closed down individually (or closed at shutdown).

This is only really an issue if you want to use this method to load up a range of different environments. If you have two environments that launch your web browser, you will end up with two browsers open. While this is not a big issue, it could become frustrating over time and is worth mentioning.


I hope you have found this article helpful, and that you may have a use to bring batch files back from the dead. Batch files are not going to make your computing experience feel modern or high tech, but they have the potential to really speed up the loading of your applications. Please stick around and check out some other articles at Inspect My Gadget for more time-saving tips and tricks.

Related Posts

78 Comments so far »

  1. Keith Dsouza said, on December 19, 2007 @ 3:30 pm

    This is a great solution to come up with for managing multiple environments, but don’t you think running multiple desktops where each desktop can hold different environments is a much more easier solution?

    The batch file is perfect for geeks but what about those that do not have that much knowledge to create the batch files?

  2. Chris Duckworth said, on December 20, 2007 @ 10:14 am

    I think running multiple desktops would be great, but there are not really any worthwhile options yet to make this happen. WindowsPager is getting close, but it is not quite ready for general consumption.

    The commands used to make these batch files are fairly basic. For many people who have played games such as Dune II and Wolfenstein, they would of had to of known more complex commands than these. I was hopeful that this guide would show how easy it can be.

    On another note, this might be useful to setup a maintenance batch. e.g. Run viruscan, when that is finished, run adaware, defrag etc one after the other. I can’t think of any way apart form batch files and complex scripts, to make programs open on after the other.

  3. Alenônimo said, on December 25, 2007 @ 5:12 am

    I use batch files to set up an local webserver on my Windows XP. I can initiate AND deactivate it with 2 batch files.

    This is possible because I’ve installed my webserver, Apache, as an service. My MySQL database is an service too. To initiate both, I use:

    @echo off
    net start Apache
    net start MySQL

    To deactivate them:

    @echo off
    net stop Apache
    net stop MySQL

    For this to work correctly, I must set up each of these services, Apache and MySQL to start manually. To configure these and all the others services, I run the command:


    It’s very productive to be able to activate and deactivate the localhost webserver. I can save resources wherever I’m not using it.

  4. Arthur said, on December 25, 2007 @ 5:28 am

    Good idea, but you should really use .cmd instead .bat for the extension these days.

  5. Jordan said, on December 25, 2007 @ 8:24 am

    .cmd vs .bat . cmd files will win every time. This is because .bat runs in the legacy software known from windows 3.1. This will of course be a 16bit mode execution and could cause some headaches in certain situations (Problem is fixed under Vista, bat runs under 32bit cmd.exe). The .cmd extension uses the cmd.exe and is a little more robust in what you can do with it.

  6. bootcat said, on December 25, 2007 @ 12:42 pm

    Also , JScript can be used to automate loads of task . This is one of my simple scripts , to clean directories .
    Any amount of directories can be added .

    // JScript based Cleanup Script

    Total = 10;
    thedir1 = “C:\\Documents and Settings\\Deepan\\Recent”;
    thedir2 = “C:\\DOCUME~1\\Deepan\\LOCALS~1\\Temp”;
    thedir3 = “C:\\WINDOWS\\Temp”;

    fso = new ActiveXObject(“Scripting.FileSystemObject”);

    for(var i=1;i

  7. Will said, on December 25, 2007 @ 2:58 pm

    There is a way to “unload” environments, but only forcefully. Using the TASKKILL command, you can close programs and processes. To close firefox.exe, you would use:

    taskkill /f /im firefox.exe

    Make sure all work is saved before terminating processes!

  8. Chris @ said, on December 25, 2007 @ 3:25 pm

    EXCELLENT article!

    So if I want to use the .cmd extension instead, just replace .bat with that?

  9. Chris Duckworth said, on December 25, 2007 @ 3:45 pm

    Hi Chris, That’s how I understand it. I will have a play tomorrow and update the article if it is right. It’s ringing a bell though, it looks like it’s the way to go. It would be interesting to see if the cmd files allow for any extra commands. I look forward to it.
    Merry Christmas

  10. Chris @ said, on December 25, 2007 @ 4:26 pm


    Yep, that’s how ya do it! Just do everything else the same, but replace “.bat” with “.cmd” and the applications FLY open.

    Is there any way to have a .bat or .cmd file open a particular video if I wanted it to?

  11. Alexander Husselhof said, on December 25, 2007 @ 6:09 pm

    It’s worth noting that if you find this sort of thing useful, you may enjoy working with open source tools that allow you to expand/customize your environment in numerous ways.

    Why not try linux in the new year?

  12. Scuba said, on December 26, 2007 @ 12:05 pm

    I’m trying to have AIM 6 run with a few other programs in this batch file. I can’t seem to get it to run at all. All of the other programs in the sequence run except for that. Here is what I put in:

    Start “” “C:\Program Files\AIM6\aim6.exe”

    I used the same positioning of the “” marks and made sure that what I wrote was the correct location. Let me know what I can do to fix it. It would be an AOL product that would keep me from doing something totally awesome :-)

  13. G said, on December 28, 2007 @ 11:37 pm

    qiucl question do any one know how to call a .bat or .cmd file in C++ ??

  14. HeartBurnKid said, on December 29, 2007 @ 10:17 am

    @jordan: That, my friend, is totally incorrect. On Win XP SP2, at least, both extensions will run in cmd.exe; neither will invoke

    Want proof? Simply copy the following into a .bat file:

    @echo off
    @echo on

    Run the .bat file, and note that the title bar displays “C:\Windows\System32\cmd.exe”

  15. ECJB said, on December 29, 2007 @ 7:09 pm

    I wrote a script to launch all my IM programs. I made a directory I:\Tools\ECJB\IM. In that folder, P placed shortcuts to my IM clients. In I:\Tools\ECJB I havw the files startim.bat and startim.txt. startim.bat takes one optional argument – stop. Without this parameter it iterates through the IM folder and launches the shortcuts. If startim stop is called, it iterates through the text file for a list of processes and I use pskill to terminate them. I could also have used shortcut.exe to parse the shortcuts for the filenames and then kill those processes so all I have to do is add new shortcuts.

    This process can work for any kind of specialized environment.

    Also, I:\Tools\ECJB is part of my PATH environment variable.

    – Eric.

  16. Mike said, on December 30, 2007 @ 2:51 am

    Hello, I have a similar script setup to launch about 10 programs I need at work. Now I run dual monitor… do you know of any program or batch file command that would allow me to define window width and height as long as X and Y coords on screen. Basically I have a Notepad width 100, Height 400 on the far top right of Monitor 2. Firefox fullscreen monitor 1. Couple other programs monitor 2 running around 400×300

  17. Mickey said, on December 30, 2007 @ 4:23 pm

    I’m having a problem with the .bat file, an maybe someone could help. I typed the winamp example to my notebook and saved it as a .bat file. When I ran it, however, the “” were read as ÔÔ. I’m running Vista, and I saved the file as directed. The file was encoded as ANSI.

    Many thanks.

  18. Sabarish said, on January 2, 2008 @ 10:20 pm

    need to know how to enter username and pwd in a webpage using batch file.
    tried the following but in vain:-

  19. Some Guy said, on January 3, 2008 @ 11:19 am

    So, for making the batch files (as one person asked earlier) you need to use notepad, not wordpad or word or anything like that.

    Just click Start > Run > type notepad and hit Enter to make the files.

    Second, why the “”? Do those really need to be there? Everything runs fine for me with just a simple –
    Start whateverprogram

    Do you need the “”‘s for when you have a program that’s installed in a folder windows doesn’t search for .exe’s in automatically?

  20. Chris Duckworth said, on January 3, 2008 @ 11:38 am

    Hey Some Guy

    There is nothing really stopping you from using word or wordpad. You can’t save as a bat or cmd file in Wordpad, you need to save it as txt and then change the filename later. A bit of a hassle.

    The “” don’t always need to be there. It is more importnat to have them there is you are using extra arguments. It is probably good practice to leave them in, but no real need for launching many programs. That’s how I tested it and it worked for me.

  21. Some Guy said, on January 3, 2008 @ 11:49 am

    Ah, makes sense. I was saying the notepad thing for the benefit of the fellow earlier, Mickey I believe. Just easier for “non-techies” to be told to use notepad rather than using word and having to worry about formatting and changing the file extension later on.

  22. Chris @ said, on January 3, 2008 @ 6:39 pm


    Do you know if there is any way to program a .cmd file to open IE7 with specific tabs opening to specific websites?


  23. Shifax said, on January 5, 2008 @ 8:18 pm

    doz any one of u know how to close a process usin textfile…coz my cmd i s acess denied…i tried to create .bat file but it didnt work out

  24. Chris said, on January 10, 2008 @ 11:51 pm

    If I wanted to create a .bat file to change/personalise the titlebar in Internet Explorer and Outlook/Outlook Express how could I do this? Can it be done?

  25. Murphy said, on January 17, 2008 @ 1:42 am

    @Alenônimo: you can use “sc” command to manipulate a windows services. By using this command you can set execution mode (auto|demand|disabled). See “sc config” for details. :)

  26. Matthew said, on January 18, 2008 @ 8:55 pm

    To Chris @,

    Though I don’t use it anymore, Maxthon (which is a gui wrapper around the IE browser) used to allow saving groups of Tabs. So you could have a “News Group” or “Finance” group or “Linux” group and it would open all the tabs at the same time for this. I am not sure what the status of Maxthon is anymore, though I expect a similar plugin is available for Firefox.

  27. Chris @ said, on January 20, 2008 @ 2:15 am


    Thanks for the info! I’ll check it out.

  28. ravikumar.kapa said, on January 30, 2008 @ 5:32 pm

    I need the batch file that should enable properties of Internet Explorer version 7(like sun java console)

  29. maydayy said, on February 12, 2008 @ 2:17 am

    hi i was wondering can anyone tell me how to push a certain button inside a certain program with a .bat, wat i mean is i want to make a .bat that will open one program and click one buton inside that program than open a 2nd program and push a button inside that program??? ty in advance

  30. Chris Duckworth said, on February 12, 2008 @ 7:57 am

    Maydayy, you might be able to setup some sort of macro. I don’t think a batch file will do the job. Windows used to contain a recorder that would store keypresses and mouse movements/clicks. I am sure there will be some free programs available to do this. You can probably then launch each macro from a batch file.

  31. Xandri said, on February 18, 2008 @ 9:27 pm

    I wrote a batch file to run an application that compiles some source code. However, this application requires the ‘filename’ of the source code (a string) as input ever time I run the batch file. Is there a way to bypass this input and allow the batch file to pass the argument directly to the application? Help will be apprciated.

  32. Murphy said, on February 19, 2008 @ 5:39 pm

    @maydayy: Try to use “AutoIt” scripting language (try google to find it) where you can do more than pushing buttons of certain applications. The documentation is full of examples, so you will find everything there.

  33. Murphy said, on February 19, 2008 @ 5:44 pm

    @Xandri: you could write another batch file where you would specify the name of the file:

    —- batch 1 —–
    call batch_2.cmd file_name

    — batch 2 —–
    :: %1 is a parameter
    run_some_stuff %1

    or you could use a “set /p var=prompt” syntax to ask for the file name.

    @echo off
    set /p answ=”Give the name of the file (TAB expands the words): ”

    echo You specified the file ‘%answ%’

    I hope this help. :)

  34. Xandri said, on February 20, 2008 @ 4:21 pm

    Thank you Murphy, this info was very helpful.

  35. st3ve said, on February 22, 2008 @ 5:30 pm

    nice article. by the way i’ve created a batchfile that would open several IE having different sites for work. only problem is that they open up in no particular order. would there be any command that would let me open my programs in a particular order.

  36. Murphy said, on February 22, 2008 @ 11:25 pm

    @st3ve: What do you mean by order? Do you mean to place different windows on different places of the screen? All you can do with AutoIt (find window by title, move it, resize, etc.) :)

  37. Chris Duckworth said, on February 23, 2008 @ 8:23 am

    Xandri, you might be able to place a pause in the batch file. A second may be enough to allow for one of them to finish loading before loading another. I am not sure what the command is to do this as “pause” will wait for for button to be pressed. An external program may be the ticket.

    Murphy, I need to check out Autolt. :) Looks interesting. I will check it out during the week.

  38. Chris Duckworth said, on February 27, 2008 @ 10:50 am

    I had a look into AutoIt. It looks like a very powerful scripting language. There is all sorts of things you can do with it and it is ideal for creating a working environment. It is capable and designed to do much more. It gets a bit complex if you try to do more than run programs. It is like learning a new language.

    It is great for doing the working environment as the Run command is easy to use and you can save your script as an exe.

  39. /\/B said, on March 8, 2008 @ 4:01 am

    CheckOut RemoteKeys. Great little prog I found about 3years back!

  40. Amniasfsff said, on March 28, 2008 @ 5:54 pm

    You can have them be closed it is a crued way but works

    Just use the kill command

  41. Denis said, on April 1, 2008 @ 7:12 am

    I want to open up multiple websites…
    I did something like …
    start c:\lotus65\notes\notes.exe

    Lotus launches fine, but only one browser opens up and only the last specified website loads(bbcworld, in this case)…

    what do i do to open up multiple browsers and load different websites…???

    plz help….m going crazy!!

  42. Chris Duckworth said, on April 1, 2008 @ 7:53 am

    Hi Denis

    Try the following formatting. It is a bit longer, but it should open a new window for each site.

    Start “” “C:\Program Files\Internet Explorer\iexplore.exe”

  43. denis said, on April 3, 2008 @ 4:11 am

    Thanks Chris…

    It works now…


  44. Sandy said, on April 22, 2008 @ 4:32 pm

    Hi All,
    can someone suggest that how i can edit the same batch file while i run that bat file at a particular time.Ex
    i want to copy a file from any particular location on daily basis but i hav to edit that bat file every day (date wise) so can somebody help.

  45. Roey said, on April 25, 2008 @ 7:08 pm


    I got a question..
    I remember back in the DOS days there was a way to do this, but I can’t find a way on XP,

    I have a file called: c:\go.bat
    I would like to run it like such- START–> RUN–> GO

    without using the extension..
    is it possible?


  46. Chris Duckworth said, on April 27, 2008 @ 5:06 pm

    Shame it doesn’t work Roey. I just played around with it. If you place the file in the Windows Directory it works. Not sure this is all that sensible though. I don’t really see why it shouldn’t go in Windows though. It feels a bit naughty. You may want to use .cmd instead of .bat extension.

  47. AK said, on April 28, 2008 @ 5:51 pm

    I have a batch file which copies an EXE file to a directory on dive C. Now what I need is to create a shortcut to run that file from the desktop, using my same batch file. I would appreciate the script with some explanation as I am a beginner. Thank you.

  48. Chris Duckworth said, on April 29, 2008 @ 3:17 pm

    AK, if you right click on the batch file, select send to followed by desktop, you will get a shortcut on the desktop pointing directly to your batch file. You can then rename the shortcut and change the icon. Is that what you were trying to do?

  49. Murphy said, on April 29, 2008 @ 4:45 pm

    @Sandy: Why do you need to edit the file each day? I understood that you need to put the new data in the script (new date as you mention). You can use a new functionality of the “set” command to extract some information from the %DATE% or/and %TIME% variables in order to create new unique name. I guess that is what you want, but you was not specific enough to be sure. If you tell me why you need to edit the batch file maybe I can find a solution which does not need editing. :)

  50. Murphy said, on April 29, 2008 @ 4:55 pm

    @Roey: If you want to run the file from the Run dialog, the batch file has to be put on the PATH. Probably the C:\ is not the default location that the run will be search for the batch files. You can modify environment to make it work:
    1) Right click on the My computer icon, then select “Properties”
    2) Select “Advanced” tab
    3) Click on “Environment Variables”
    4) Find the “PATH” variable, select it, then press “Edit”
    5) In the “Variable Value” add at the beginning “C:\;”. Remember to leave rest of the directories, so your system will still work.
    6) Close all the opened windows by clicking “OK” on each one.

    Now the “C:\” should be on the PATH so each batch/exe file can be found and executed from Run dialog box.

  51. AK said, on April 30, 2008 @ 12:12 am

    Dear Chris, thank you for your reply. I do not want to create a short cut on the desktop myself but rather I would like the batch file to do that for me.
    For example, just as you would normally install a program, a desktop icon is created for the user; likewise I would like my batch file to do that.
    Thank you.

  52. Chris Duckworth said, on May 1, 2008 @ 1:06 pm

    AK, that’s getting a little trickier. You can use VB scripts and other complex things to make it happen, but I found it a bit too complicated.
    Would this work… Keep the shortcut static, always pointing to the same file. Use the rename command in your batch file to rename the most current file to the file the shortcut is pointing to. As it renames a file, rename the old one back.
    Either method is not easy.

  53. Murphy said, on May 4, 2008 @ 8:11 pm

    @AK: For creating a shortcut try to use a nircmd command line tool ( One of the parameter for this tool is “cmdshortcut” which will do what you want. :)

  54. jinkx said, on May 14, 2008 @ 1:13 am

    whell im kinda new at wrighting .bat files and i can do only simple things but i was wondering if anyone knows about any websights to help me learn beter

  55. AK said, on May 15, 2008 @ 8:42 pm

    Dear Murphy, Thank you so much for pointing me into the right direction. That command line tool, NIRCMD was very handy and I managed to do what I wanted.
    May the Lord shower his Mercy on all of us.

  56. jamez said, on June 12, 2008 @ 2:32 am

    my .cmd file reads as follows:
    START “” “C:\Program Files\Internet Explorer\iexplore.exe”
    however, the last url opens as
    why won’t it open to the search filters that i specified?

  57. jamez said, on June 12, 2008 @ 2:52 am

    never mind. i figured this out.

  58. Adrian said, on June 30, 2008 @ 11:06 pm

    Hi guys,

    How can I open multiple URLs in multiple browser tabs (not windows) using batch file?

    It works in Firefox, just put the internet addresses side by side and they will open in different tabs within the same Firefox window; but it doesn’t seem to work with IE.


  59. Marius said, on July 5, 2008 @ 11:32 am


    Great article. At least for me who’s a newbe.

    I only want to know if it’s posible to make a autorun-file so when i open a document with a batch-file inside, if i can make a autorun-file that runs when i open the document?

    I know it’s posible to make autorunfiles who run in cd’s. But what about the hardisk?

  60. Chris Duckworth said, on July 6, 2008 @ 3:30 pm

    Hi Marius, I am a bit confusd as to what you are asking. It is possible to call batch files from another batch file. There are programs like nirCMD that let you make shortcuts that will run multiple programs from a single shortcut. If you can explain what you would like to do more clearly, I can try to help more.

  61. Chris said, on July 10, 2008 @ 10:04 am

    I have a folder of 1000 files that I need to convert to another file type (.fla to .swf). I found a .exe that will do this one file at a time. I’m wondering if there is a batch file I can create that will open a program (FLA2SWF.exe) and run it for every file in a specified folder?

  62. gnetiv said, on July 17, 2008 @ 2:02 am

    Hello all

    I have a internal website that gives me access to a admin console. I can launch the site with a script but I need to be able to enter a password to get to it. The username always stays the same on the page. I’ve tried the suggestions here:
    set /p password=%password%

    but no luck.

    Thanks in advance

  63. sanjay said, on July 17, 2008 @ 3:10 am

    how i can open multpul website st a time

  64. Jos Grupping said, on August 18, 2008 @ 8:53 pm

    Hello fellows,

    I use a setup with DOSBox and a series of batch files for starting up old (DOS) versions of Microsoft Flight Simulator.

    Since a few weeks I have a nasty problem. All the sudden the batch files stoppen running: they just open in Notepad instead. That is at the menu-option “Open”. And I can’t find a place where I can change this association of the .bat extenson. If I remember correctly there also used to be the option “Open with …” but I ca’t find that anymore.

    I did find a work-around by creating a new user account and tried to start my batch file there. It does work, but then I have to re-create the whole background for this new user account, which I don’t intend to do.

    Can anyone tell me what might be the reason for this unwanted coupling and how i can restore the old situation? Help would be very much appreciated.

    Jos Grupping
    The Netherlands

    webmaster of the Flight Simulator History website

  65. Chris Duckworth said, on August 18, 2008 @ 9:48 pm

    Hi Jos

    You have an interesting problem. I haven’t experienced it myself, but maybe changing the extension to cmd instead of bat may work? IT should work the same way, you are just taking away any links that the bat extension may have developed.

    I have a couple more ideas up my sleeve if this doesn’t work.


  66. Jos Grupping said, on August 19, 2008 @ 1:13 am

    Hi Chris,

    Thanks for the prompt and GOOD reply. IT WORKS OK, hurray!

    So I can continue now, which is very good, but it would be even better if I would be able to break that association between batch files and Notepad.

    One more remark about that: normally in Explorer, if you click on a file with the right mouse button, you get a pop-up menu with the option “Open” and a bit lower the option “Open with”. With the latter option you are able to change the standard association.

    However, in the case of .bat files that second option is missing in the pop-up menu. Why??? Maybe this gives you an extra clue?

    Anyway, many thanks for your reply so far,

    Jos G.

  67. Chris Duckworth said, on August 19, 2008 @ 9:25 am

    Hi Jos

    It occured to me… can you make sure that file extensions are shown. This can be done from explorer > tools > folder options > view. Maybe the file is really called file.bat.txt. This may be creating the association with notepad. If file extensions aren’t shown, it will appear as file.bat. A good indicator is the icon of the file.

    The “open with” shouldn’t be shown for a bat file. Only open and edit. Windows sees a bat file as a program, rather than a document.

    To change what program opens a file extension, this is also done in folder options. Bat files and cmd files are not listed though.

    Hope this helps.

  68. Jos Grupping said, on August 20, 2008 @ 3:58 am

    Hi Chris,

    Thanks again, but that’s not the case I have “Hide file extensions for known file types” not chequed. Please forgive me if that’s not the exactly correct term, because I use a Dutch Windows version and have to try to translate the terms. So file extensions are all shown and it’s not: file.bat.txt.

    BTW, the trick of changing .bat into .cmd works fully, so I can work in my normal user-account. Which makes things a lot easier. Thanks a millon. However it hurts me that normal .bat files still don’t work.

    As you mention, there is (or in my case there was) a list of all file extension associations.The problem is that I can’t find that list any more. Although, if .bat and .cmd are not shown, it won’t help me with the .bat problem!?

    Anyway I still would like to have accesss to that list, because a recent unintended installation of some odd audio/video player has hyjacked all my audio and video extensions.And finding them al to set back manually is virtually impossible. But where has the list gone? I remember vaguey a function under the main configuration screeen, but maybe that was under Windows XP?

    So the status is: thanks to your advise I can work again, be it a bit crippled. But I really would like to find the real solution.

    Cheers again,

    Jos G.

  69. Chris Duckworth said, on August 20, 2008 @ 12:42 pm

    Hi Jos, I am glad that changing the extension worked. I am very confused as to why the open with option isn’t available. I have no idea how to bring it back. Probably a registry hack. The How-to geek website is full of good registry hacks that may bring it back.
    To solve how your file associations are broken, I recently came across a program called Types which will help recreate those associations quickly. Check out this article for more information.
    I hope you get some value out of my reply 😐

  70. Ben said, on September 30, 2008 @ 5:09 am


    Using the cmd shell, you can print the list of filetype associations in Windows.. simply open the command shell and type
    assoc > associations.txt

    This will output all filetype extensions to a text file, which you can open and browse. (The command’s output is too large to be viewed in the command shell)

    To view just the .bat, type
    assoc .bat

    My association for “assoc .bat” is

    If that isn’t what yours returns, you can change it by entering
    assoc .bat=batfile

    Hope it helps!

  71. Chris Duckworth said, on September 30, 2008 @ 8:52 am

    Ben, there are some great tips in your comment. I never knew you could do that. Very useful. Cheers.

  72. Camn Ron said, on November 6, 2008 @ 11:04 am

    Hey Guys, I love this thread.
    Lets make it move faster.
    I love learning how to use batch files.
    I am pretty experienced in them. Can someone give me some Experienced Examples?
    in Vista
    @echo off net user administrator activate:yes
    anyways Be back everday to see who put something up for me and of course reply

  73. Justin said, on November 13, 2008 @ 8:09 pm

    Hi Camn

    Here is a challenge for you.
    I want to run an html file that ive created from system start up. The trick is when the file opens up, i want it to automatically open up in fullscreen. Could you help me?

  74. Chris Duckworth said, on November 14, 2008 @ 8:32 am

    Hi Justin, IE has a kiosk mode that will load the page in full screen.
    iexplore.exe -k
    Alt-tab will let you close it down.
    You can create a shortcut in your startup menu. I hope this has been helpful.

  75. aqi said, on March 23, 2009 @ 3:48 pm

    hi, how do we invoke batch files from c++.?

  76. Chris Duckworth said, on March 25, 2009 @ 9:04 am

    Hi Aqi, it would be like launching a progrom from within C. Look up the Shellexecute command, or the system command. I don’t know C, so I am not shure of the code, but it is bound to be possible.

  77. MrCEO said, on April 16, 2010 @ 1:45 pm

    here’s a batch file. Name it the Martix.bat
    @echo off
    color 2
    echo %Random% %Random% %Random% %Random% %Random% %Random% %Random% %Random% %Random%
    goto start
    It does nothing that is worth it but it kills time and is fun

  78. Ricky Tan said, on January 9, 2011 @ 10:47 pm

    Is there a way to create a file that will open a saved EXTENDED DESKTOP SCHEME (HDTV) and then change my SOUND DEVICE to Hdmi? Dell Inspiron 1525/ Windows Vista

Leave a Comment

Name: (Required)

E-mail: (Required but will not be published)