I'm running wampserver 2.2 on Windows 7, and I'm trying to use NirCmd to mute windows volume. My code is:
<?php
exec("c:\nircmd\nircmdc mutesysvolume 1");
?>
The command seems to work well, and mute my sound when run not via PHP, but doesn't work through PHP.
Help anyone? Or any other suggestions on how to make a remote control using PHP?
Thanks
The sequence \n inside a double-quoted string resolves to a newline character, destroying your path.
You can use single quotes instead:
exec('c:\nircmd\nircmdc mutesysvolume 1');
Or, even better, use forward slashes instead of backslashes to avoid the problem entirely:
exec('c:/nircmd/nircmdc mutesysvolume 1');
if you use double quoted string do it like ( and try .exe ). Or like "Jon" said use forward slashes.
exec("c:\\nircmd\\nircmdc.exe mutesysvolume 1");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With