Help writing a batch file - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: Help writing a batch file (/showthread.php?tid=90287) Help writing a batch file by MeEtc on 04-21-2009 at 03:09 AM
Who's good with command line programming? code: RE: Help writing a batch file by Jarrod on 04-21-2009 at 05:43 AM
IMO python would be a much better solution to this python code: RE: Help writing a batch file by MeEtc on 04-21-2009 at 05:55 AM that would require that python is installed on my pc, which its not... RE: Help writing a batch file by Jarrod on 04-21-2009 at 06:47 AM
you could just compile the python into an exe but that would require python and py to exe, i would but i don't use exe anymore RE: Help writing a batch file by Dempsey on 04-21-2009 at 07:44 AM
Something like this should do it: code: RE: Help writing a batch file by CookieRevised on 04-21-2009 at 04:09 PM Dempsey got it... Although he made a woopsy with the find parameters: code:PS: other changes: - 1>NUL 2>&1 will also surpress error messages on screen. - Reason for 2 seperate IFs instead of the IF tHEN ELSE like before is so that the second one is not executed when an error (=errorlevel 2) occurs in the FIND command. - Added parameter /T to taskkill command which will kill the process tree instead of only the process. - No reason to first change the current directory to the respective program folders RE: Help writing a batch file by Dempsey on 04-21-2009 at 05:15 PM
Ah yea, I had the speech marks escaped because I copy and pasted it from a FileMaker script. RE: Help writing a batch file by Mike on 04-21-2009 at 06:00 PM Don't forget that taskkill.exe is only available in the Professional edition of Windows XP! Not sure about Vista though. RE: Help writing a batch file by MeEtc on 04-21-2009 at 06:24 PM I have xp pro, so all is well. Thanks cookie and dempsey, I'll try it out tonight RE: Help writing a batch file by MeEtc on 04-22-2009 at 02:27 AM Having a problem with the second half of the script with synergys.exe. The batch file won't continue running because synergys.exe is still running. ultramon.exe won't start until synergys.exe stops. Any way around that? RE: Help writing a batch file by Jarrod on 04-22-2009 at 03:35 AM
quote: use the start command instead. so start "c:\program files\synergy\synergys.exe" -a pieceofcrap:24800 -d FATAL start "c:\program files\ultramon\ultramon.exe" /d RE: Help writing a batch file by MeEtc on 04-22-2009 at 04:26 AM
had to modify that slightly to get it to work properly to: RE: Help writing a batch file by CookieRevised on 04-23-2009 at 06:54 AM
quote:What second half? What you mean by "synergys is still running"? You mean taskkill doesnt kill the synergys process ? I ask this because it makes little sense that by adding START to everything it all of a sudden does work. Because you should not explicitly need the START command to start a program! You only explicitly need START if you want to alter the console window like the title, minimized state, change the priority, wait for the app to quit, etc... It should work perfectly without it, provided taskkill does kill the process in time. For that reason, and only that reason, it might be a good idea to build in a wait period before running "c:\program files\ultramon\ultramon.exe" /e so that taskkill has some time to kill the synergys process. As that is the problem from what I understand from your post. So, simply adding START like Jarod said doesn't make any difference and wont fix anything and you will most likely experience the same problem another time (when taskkill needs some more time than instant for whatever reason to kill synergys). So instead of adding START everywhere, try to change: taskkill /f /t /im synergys.exe to start /wait taskkill /f /t /im synergys.exe this should pause the batch until taskkill has done its job instead of immediatly executing the next line (starting ultramon). RE: Help writing a batch file by Vilkku on 04-23-2009 at 07:27 AM
Was about to comment on that part you just edited out, Cookie... the reason I (and I bet most other) use Ultramon is to extend the taskbar to the second monitor. If you know another (freeware application that does it, then I'd be very interested in it (I know there is one but it doesn't have the proper Vista skin in the free version and it also for some reason wants to add stuff like the clock to the second taskbar). RE: Help writing a batch file by CookieRevised on 04-23-2009 at 07:37 AM
quote:Yeah sorry, wasn't realy relevant to the thread... quote:On my other computer the video drivers has that build in. Nevertheless, I don't like having an 'extended' taskbar. For that matter, I know Ultramon has some other nifty features, but all features I personaly would never use. So its kind of useless to me.... hence my (removed) comments. quote:Yeah, looked it up. Sound like a cool thing and very innovative/original I think to use TCP/IP. Although by the way it works, it sure must have problems with certain programs and stuff. But again no use for me as I have a 2 'Blackboxes' for that (second hand of course, way too expensive otherwise ) of which one is a matrix switch, so I can have any monitor for any PC. Should have known about senergys before I bought them, damn... EDIT: although, now that I think about it, don't you need all the connected PCs to be running if you want to use a particular monitor in that case? Which is a no-go in my case... blah... those two 'blackboxes' makes my whole desktop a bit cooler (more lights and switches and stuff you know ) RE: Help writing a batch file by foaly on 04-23-2009 at 12:01 PM
quote: Ehm as far as I know you do... try this as a batch file: code: it will only start notepad after paint is closed... but the second part will start them both... RE: Help writing a batch file by MeEtc on 04-23-2009 at 03:12 PM Yes foaly, that's exactly whgats happening. The batch file was waiting for synergys.exe to finish running before running the coomand to shut off the secondary monitor. As I said earlier, I have it working now, and that's all that really matters. RE: RE: Help writing a batch file by CookieRevised on 04-23-2009 at 10:22 PM
quote:Ah, programs opening a window and keep on running... forgot about that. I never use a batch file to start a windows based program or program which keeps running and I didn't knew that ultramon or synergys with those command line parameters would still be running after doing their thing, stupid me. For all other normal batch file stuff (as I like to call it now ) you should not use START though as it opens the program in another console thread and thus you can't control, check or redirect the output or even know if program A starts before program B. You learn something new every day. Thanks foaly RE: Help writing a batch file by Jarrod on 04-23-2009 at 10:39 PM
quote:that's why I said use start, I just wasn't fast enough |