Solved I'd like to write a script to turn off shuffle in Windows Media Player

pxfragonard

New member
Power User
VIP
Local time
2:11 PM
Messages
339
Could someone show me how to do that, please?

Sorry. I have Task Manager open WMP at a particular time to wake from hibernation. Then there's a scheduled task to play a wakeup playlist.

So I actually want a script or .bat file to open WMP and turn off shuffle so the playlist plays in the proper order.
 
Last edited:

My Computer My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bit 7601 ...Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz6 GBRadeon 6750 1gb
Computer Manufacturer/Model Number
HP Pavilion p6745f
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz
Motherboard
PEGATRON CORPORATION 2AB6
Memory
6 GB
Graphics Card(s)
Radeon 6750 1gb
Sound Card
(1) IDT High Definition Audio CODEC (2) Intel(R) Display A
Monitor(s) Displays
Acer x193w
Hard Drives
(1) WDC WD15EARS-60MVWB0 (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) WD My Book 1110 USB Device
PSU
Internal 500W (100V-240V)
Case
Mid-size ATX
Cooling
unknown
Keyboard
HP usb multimedia keyboard
Mouse
HP usb compliant mouse
Internet Speed
256 kbps
Other Info
Ver: CHI_713.bin vCHI7.13
Here's a command that will turn shuffle off in Windows Media Player. Run this before starting your playlist.
Code:
reg add "HKCU\Software\Microsoft\MediaPlayer\Preferences" /v "ModeShuffle" /t REG_DWORD /d 0 /f
 

My Computer My Computer

At a glance

Windows 10, Windows 8.1 Pro, Windows 7 Profes...
Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
Thank you!

Here's a command that will turn shuffle off in Windows Media Player. Run this before starting your playlist.
Code:
reg add "HKCU\Software\Microsoft\MediaPlayer\Preferences" /v "ModeShuffle" /t REG_DWORD /d 0 /f
Thanks very much. I've pasted that into Notepad and saved it as a .bat file. If I program my task scheduler to run that before the playlist is scheduled, that ought to work, eh? Then I can just manually turn shuffle on when I want it. That's just great. Appreciate it!
 

My Computer My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bit 7601 ...Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz6 GBRadeon 6750 1gb
Computer Manufacturer/Model Number
HP Pavilion p6745f
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz
Motherboard
PEGATRON CORPORATION 2AB6
Memory
6 GB
Graphics Card(s)
Radeon 6750 1gb
Sound Card
(1) IDT High Definition Audio CODEC (2) Intel(R) Display A
Monitor(s) Displays
Acer x193w
Hard Drives
(1) WDC WD15EARS-60MVWB0 (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) WD My Book 1110 USB Device
PSU
Internal 500W (100V-240V)
Case
Mid-size ATX
Cooling
unknown
Keyboard
HP usb multimedia keyboard
Mouse
HP usb compliant mouse
Internet Speed
256 kbps
Other Info
Ver: CHI_713.bin vCHI7.13
If I program my task scheduler to run that before the playlist is scheduled, that ought to work, eh?
Yes.

Glad you found what you're looking for. Remember to mark the answered thread as Solved.

Also, you do not need to wrap the command into a batch file. Let Task Scheduler run the command directly. ;)
 

My Computer My Computer

At a glance

Windows 10, Windows 8.1 Pro, Windows 7 Profes...
Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
If I program my task scheduler to run that before the playlist is scheduled, that ought to work, eh?
Yes.

Glad you found what you're looking for. Remember to mark the answered thread as Solved.

Also, you do not need to wrap the command into a batch file. Let Task Scheduler run the command directly. ;)
Thanks. Just wondering if turning shuffle back on would be written:

reg add "HKCU\Software\Microsoft\MediaPlayer\Preferences" /v "ModeShuffle" /t REG_DWORD /d 1 /f

Is that right?
 

My Computer My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bit 7601 ...Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz6 GBRadeon 6750 1gb
Computer Manufacturer/Model Number
HP Pavilion p6745f
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz
Motherboard
PEGATRON CORPORATION 2AB6
Memory
6 GB
Graphics Card(s)
Radeon 6750 1gb
Sound Card
(1) IDT High Definition Audio CODEC (2) Intel(R) Display A
Monitor(s) Displays
Acer x193w
Hard Drives
(1) WDC WD15EARS-60MVWB0 (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) WD My Book 1110 USB Device
PSU
Internal 500W (100V-240V)
Case
Mid-size ATX
Cooling
unknown
Keyboard
HP usb multimedia keyboard
Mouse
HP usb compliant mouse
Internet Speed
256 kbps
Other Info
Ver: CHI_713.bin vCHI7.13
That's right.
 

My Computer My Computer

At a glance

Windows 10, Windows 8.1 Pro, Windows 7 Profes...
Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
Thanks! I may be getting the hang of it... (a wee bit)
 

My Computer My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bit 7601 ...Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz6 GBRadeon 6750 1gb
Computer Manufacturer/Model Number
HP Pavilion p6745f
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz
Motherboard
PEGATRON CORPORATION 2AB6
Memory
6 GB
Graphics Card(s)
Radeon 6750 1gb
Sound Card
(1) IDT High Definition Audio CODEC (2) Intel(R) Display A
Monitor(s) Displays
Acer x193w
Hard Drives
(1) WDC WD15EARS-60MVWB0 (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) WD My Book 1110 USB Device
PSU
Internal 500W (100V-240V)
Case
Mid-size ATX
Cooling
unknown
Keyboard
HP usb multimedia keyboard
Mouse
HP usb compliant mouse
Internet Speed
256 kbps
Other Info
Ver: CHI_713.bin vCHI7.13
Hmm. I find it doesn't work and know why. I fall asleep (and the computer is set to hibernate) looking at photographs and listening to music. So, when the computer wakes up to wake me up, WMC is still running and so the command to turn shuffle off doesn't work. I've tried running the command with WMP on and it doesn't work so I assume it's the same when WMC is on since they share. Running the playlists in WMC won't help. I guess I need to find a way to turn WMC off before hibernation.
 

My Computer My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bit 7601 ...Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz6 GBRadeon 6750 1gb
Computer Manufacturer/Model Number
HP Pavilion p6745f
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz
Motherboard
PEGATRON CORPORATION 2AB6
Memory
6 GB
Graphics Card(s)
Radeon 6750 1gb
Sound Card
(1) IDT High Definition Audio CODEC (2) Intel(R) Display A
Monitor(s) Displays
Acer x193w
Hard Drives
(1) WDC WD15EARS-60MVWB0 (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) WD My Book 1110 USB Device
PSU
Internal 500W (100V-240V)
Case
Mid-size ATX
Cooling
unknown
Keyboard
HP usb multimedia keyboard
Mouse
HP usb compliant mouse
Internet Speed
256 kbps
Other Info
Ver: CHI_713.bin vCHI7.13
The 'turn off shuffle' command, as you found, does not affect an existing Windows Media Player process. After applying the command, you are to start a new instance of WMP.

And afaik, because only one instance of WMPlayer.exe is permitted at a time, my only suggestion for you is to kill and restart WMP, and perhaps WMC too. I noticed you've already caught on to this idea and you have recently started a thread where you ask for a command that closes the WMC window (I assume this thread and that thread relate).

Killing WMC/WMP, running the 'turn off shuffle' command, then invoking your playlist seems like the only option. To assure this happens in linear sequence, a batch script may be needed.


The command to kill Windows Media Centre:
Code:
taskkill /im ehshell.exe
The command to kill Windows Media Player:
Code:
taskkill /im WMPlayer.exe
 

My Computer My Computer

At a glance

Windows 10, Windows 8.1 Pro, Windows 7 Profes...
Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
The 'turn off shuffle' command, as you found, does not affect an existing Windows Media Player process. After applying the command, you are to start a new instance of WMP.

And afaik, because only one instance of WMPlayer.exe is permitted at a time, my only suggestion for you is to kill and restart WMP, and perhaps WMC too. I noticed you've already caught on to this idea and you have recently started a thread where you ask for a command that closes the WMC window (I assume this thread and that thread relate).

Killing WMC/WMP, running the 'turn off shuffle' command, then invoking your playlist seems like the only option. To assure this happens in linear sequence, a batch script may be needed.


The command to kill Windows Media Centre:
Code:
taskkill /im ehshell.exe
The command to kill Windows Media Player:
Code:
taskkill /im WMPlayer.exe
Thanks. Yes, I tried taskkill /f /im ehshell.exe to kill WMC and noticed it also closes WMP in task manager within a few seconds, probably because WMC is dependent on WMP. I could program a timer to run taskkill /f /im ehshell.exe just before hibernation so that WMP would play my playlist in order on waking but then I wondered what would happen if, for some reason, WMC isn't running at the time. I don't suppose it would it have any ill effect if it weren't running but I like to check these things first. And I don't understand the "if" part of the language.
 

My Computer My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bit 7601 ...Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz6 GBRadeon 6750 1gb
Computer Manufacturer/Model Number
HP Pavilion p6745f
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz
Motherboard
PEGATRON CORPORATION 2AB6
Memory
6 GB
Graphics Card(s)
Radeon 6750 1gb
Sound Card
(1) IDT High Definition Audio CODEC (2) Intel(R) Display A
Monitor(s) Displays
Acer x193w
Hard Drives
(1) WDC WD15EARS-60MVWB0 (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) WD My Book 1110 USB Device
PSU
Internal 500W (100V-240V)
Case
Mid-size ATX
Cooling
unknown
Keyboard
HP usb multimedia keyboard
Mouse
HP usb compliant mouse
Internet Speed
256 kbps
Other Info
Ver: CHI_713.bin vCHI7.13
Aside from a small error message, there is no "ill" effect if you ran, say, taskkill /im ehshell.exe and the WMC process did not exist to be killed in the first place.

You can suppress an error message produced by a command by redirecting StdErr (stream 2) to NUL:
Code:
taskkill /im WMPlayer.exe 2>NUL
If Windows Media Player doesn't exist, and you run the above command, no error message will display.


You may type help if or if /? into a command prompt to view help information for the if command.
 

My Computer My Computer

At a glance

Windows 10, Windows 8.1 Pro, Windows 7 Profes...
Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
Back
Top