I'm trying to make a bat file that when launched will open a mediafile and close after x-number milliseconds.
mediaplay [play time] [audio file]
I'm trying to use nircmd's media play command, but it dosen't recognize it. I've tried the following codes in cmd.
C:\Users\Lind>mediaplay 10000 "C:\Users\Lind\Music\1.mp3"
'mediaplay' is not recognized as an internal or external command,
operable program or batch file.
I've also tried this but nothing happend
C:\Users\Lind>nircmd.exe mediaplay 10000 "C:\Users\Lind>Music>1.mp3"
**************************************Update************************************
I found out that I've made a mistake in the mp3 file directory name, now it just says
C:\Users\Lind>nircmd.exe mediaplay 10000 "C:\Users\Lind>Music\1.mp3"
Access is denied.
I've tried using cmd as an adminstrator, but then nothing happens.
In order to execute any external command (ie. any command that is not internal to
cmd.exeitself), then you need to do one of the following:Specify the precise location of the executable (eg use
"c:\wherever\your\mediaplay\is located\mediaplay"in place ofmediaplay(quotes required if the path or executable name contains separators like spaces))Include the directoryname for
mediaplayinto thepathvariable. This can be done on a permanent basis by usingControl Panel>System>Advanced System Settings>Advanced>Environment Variablesor preferably by using a dedicated editor likePath Editoror on a temporary basis by prefixingthat path;to thepathvariable within a batch or manually from the prompt.Navigate to the
mediaplayerdirectory using the three lines "pushd mediaplayerdirectoryname", "mediaplayer...", "popd" (all without the quotes)The last method is a special case of the second which uses the windows' executable-search strategy to look for an executable first in the current directory, and then in each directory specified in the
pathvariable in turn until the executable is found.