| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 42873 | 2004-02-25 10:26:00 | batch files again | Blue_face (1148) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 218162 | 2004-02-25 10:26:00 | Hi, just wondering, how do you write a command in a batch file to terminate/close a program? eg: close windows media player while its running? thanks |
Blue_face (1148) | ||
| 218163 | 2004-02-25 10:47:00 | is this what you are looking for www.ss64.com |
beama (111) | ||
| 218164 | 2004-02-25 10:52:00 | or this one www.ss64.com ok the reference file then www.ss64.com I think these comands will only work on nt based kernal operating systems ie nt,win2k,xp home and pro |
beama (111) | ||
| 218165 | 2004-02-25 11:04:00 | just a note of caution here read those instructions carefully especially the footnotes |
beama (111) | ||
| 218166 | 2004-02-25 11:15:00 | hello beama. unless i dont know how to use the command correctly, or if i have misunderstood what is in the website that u have given, i dont think its really what is what im looking for :( anyway.... let me make it more clear, cos i think wht i posted was actually very slack, and i dont even know if it can be done. :-\ ok, imagine this, i have wrote a very simple batch file lets just say i want to play a video file, (just with this command: video.avi). lets say the avi file was play using the default windows media player program, and after the file finish playing, it just stay there. the program dont actually go away unless u manually close it. so, what i want to do is, i want to add a command in the batch file that will actually close the program (win media player) for me as well instead of just lay there after it finish playing. so, i dont know if there is such a thing. so, if the kill command is the right command for it, then probally i just dont know how to use it correctly, so can u please write it out exaclty for me :) thanks. btw, running winxp pro |
Blue_face (1148) | ||
| 218167 | 2004-02-25 18:25:00 | interesting, sounds possible but I have never done it so ill do some expermenting, in the mean time I think the person you need is Parry he is a wiz with batch files lets hope he reads this thread and is able to help watch this thread at this satge I think you will need to pause/ delay the batch file while media player completes its task then issue the kill comand then i suppose because you are in bed asleep by now your what your pc to be shutdown from the batch fie, i know this is possible(what next remote controls for tv's :) ) |
beama (111) | ||
| 218168 | 2004-02-26 00:19:00 | Batch system is a primitive, limited, scripting system. Try getting a command window,and seeing if there are any options for the media player. If it can be started from batch, it "ought" to have an option which will tell it to run then exit. You will need to discover the name of the executable, then something like nameofmediaplayer.exe /? might tell you want you need. If there's something appropriate you would then invoke it, giving the name of the file to be played as an argument, and the option which tells it to exit.(e.g. nameofmediaplayer.exe /x /f=video.avi). |
Graham L (2) | ||
| 218169 | 2004-02-26 02:43:00 | Check out media player classic, it supports a command line interface and can even return an error level!! | ugh1 (4204) | ||
| 218170 | 2004-02-26 10:10:00 | Yes Graham I would agree, but I do believe they can still be useful, in this case they are very limited I would considered using a vbs script file, but he asked for a batch file and here is what I have come up with. It needs windows scheduler because I know of no way a batch file can monitor a process or thread to see if it active, so scheduler will need to set up to run this batch file at a certain time Batch File @echo off rem ************************************************** ************ rem This batch file will shutdown the media player process rem and log off windows session. Tested on Xp Pro rem Use windows scheduler to run this batch file at specified time rem ************************************************** ************ rem kill process wmplayer.exe rem for more help on tskill type "tskill/?" at cmd prompt tskill wmplayer rem log off windows session rem for more help with shutdown type "shutdown/?" at cmd prompt shutdown -l |
beama (111) | ||
| 218171 | 2004-02-26 12:20:00 | Thank you beama :) it is what im looking for, I will do other experiments from there. |
Blue_face (1148) | ||
| 1 2 | |||||