RC-Monster Forums

RC-Monster Forums (https://www.rc-monster.com/forum/index.php)
-   General Discussion (https://www.rc-monster.com/forum/forumdisplay.php?f=20)
-   -   WindowsXP Question (https://www.rc-monster.com/forum/showthread.php?t=29915)

What's_nitro? 04.29.2011 09:05 AM

WindowsXP Question
 
So I've been using Taskkill to close Windows Media Player through Task Scheduler via a .batch file. I put music on when I go to bed and set it to close an hour later. Now, for some reason, the batch file won't do it's job when opened through the Task Scheduler. If I open the batch file directly (right-click, open) it works fine. If I go into Task Scheduler and manually run the task, I can see the CMD window flash- so I believe it is opening the batch file, but it doesn't close WMP. Nothing has changed (to my knowledge) since two nights ago (the last time it worked) so I don't have a clue what's going on.

Wierd, huh? :neutral:

BrianG 04.29.2011 09:54 AM

Unsure why taskkill isn't doing the job. I use taskkill in a batch file at work on a Windows Server 2008 box and it works fine as a scheduled task. I don't have an XP box ATM to look, but is there an option for the scheduled task properties to run with elevated permissions or something like that?

Alternatively, why not set up a batch file that you run manually before you go to bed. That way, it will run for an hour (or whatever time frame you want) after you run it, not on a specific time.

This is the batch I run at work to open IE, run something, and then kill it after 60 sec (I blanked out the actual URL):

start iexplore address url
ping -n 1 -w 60000 1.1>nul
taskkill /pid iexplore.exe

The ping part, which really does nothing except adds a delay, is what causes the batch to wait 60 sec (60,000 milli-seconds) before it kills the process. For an hour, the wait value would be 3,600,000

josh9mille 04.29.2011 10:18 AM

couldnt you just set your computer to go to sleep/idle/shut off an hour after you last touch it?

What's_nitro? 04.29.2011 01:09 PM

Brian- I'm an admin on my PC, so it's not a permissions problem. I think I'll try putting a timer on the taskkill command.

Josh- I could do that, but I usually keep it on so that I can access it quickly. I don't feel like waiting 39 seconds for it to boot up. :lol:

Thanks guys!

BrianG 04.29.2011 01:24 PM

You could have it set to standby or hibernate, not reboot:

Standby %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Standby

Hibernate %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Hibernate

What's_nitro? 04.29.2011 01:41 PM

I know, but I just prefer to keep it on.

The "direct from batch file" approach works fine. I'm using this code:

start wmplayer.exe "D:\Music\!Playlists\Playlist1.wpl"
ping -n 1 -w 3600000 1.1>nul
taskkill /f /im wmplayer.exe

The Task Scheduler approach required me to manually change the runtime for the batch file every night, since I rarely get to bed at the same time two nights in a row. This way is much simpler.

BrianG 04.29.2011 02:35 PM

I would first set a smaller interval, something like 30 seconds, to make sure it works like you want.

What's_nitro? 04.29.2011 04:26 PM

I did. I tested it with "3600" as the delay. :smile: Thanks!


All times are GMT -4. The time now is 08:34 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.