How can I play mp3 files in Windows 11 using cmd? - c

I made an app recently that I'm proud of. It's an alarm that plays music at a designated time. I use the Windows Command Prompt to play the .mp3 file. I'm using C, so I've been trying to use the system() method. However, I've realized that this won't work on computers that have Windows 11, as they got rid of Windows Media Player being installed with Win11. I also have Win11, but it worked on my computer because I installed it.
Win11's media player is called "Media Player," and I can't find a way to play mp3 files through the command line with it. I've tried "fmedia," "wmplayer," "start," and others but none of them work.
So how can I play an mp3 file on Windows 11 using the Command Prompt without installing extra software?

Related

Fixing corrupted WinCE 6.0 from USB or SD card

I have an ARM v4 device with touchscreen running Windows Embedded 6.0.
I am developing new app for it (as a replacement for the old one). Everything worked correctly but I accidentally renamed file that was intended to run at startup (if it helps it is autorun.exe in /NAND folder) and now the Win does not start.
At startup error is shown and after clicking OK the process is stuck.
I need to revert this change (rename file back) but how to do it?
I cannot connect to the device anymore with Visual Studio, Remote File/Registry Viewer or similar tool as the conman is not running and I cannot run them (because Windows is not started yet, obviously).
Is there any way how to run cmd line or some tool from SD Card or USB or Ethernet where I can execute some command to rename file back?
I do not have the OS image or the knowledge to build it from scratch, that is too complicated for me.

Making a repeating alarm in a batch file

Ok, so I have 0 experience with this, yet I managed to put this together by reading from different forums:
:loop
"sndrec32 /play /close
"C:\Users\...\sound.mp3"
timeout /t x
goto loop
It plays a sound every x seconds. Is there a way to make it play the sound without the media player popping-out on the screen, and when it's done playing the sound - to close itself (the player)? What about the command promt not popping-out on the screen? I basically want to have as few pop-ups on the screen as possible when launching the file.
Thanks!
EDIT: Solved, see my reply
With MediaPlayer ActiveX object . This could be problem for a people without installed MediaPlayer (e.g. Windows XP required genuine authentication in order to install it) and it can acts differently on different windows versions (e.g. on some windows version auto closing does not work as expected). Here's my implementation (does not create temporary files).Example:
call mediaRunner.bat "C:\Windows\Media\Ring05.wav"
On every windows machine there are installed SP ActiveX objects which are capable to run .wav files (no mp3 and so on). Here's one script.Expample:
call spPlayer.bat "C:\Windows\Media\Ring05.wav"
and we have also HTA/InternetExplorer applications and their bgsound tag.Which also allows you to control the volume of the played song:
call htaplayer.bat "C:\Windows\Media\Ring05.wav" -1000

My application won't show up in Windows 10 Start search

I wrote a Win-32 desktop application in 1999 and have maintained it through the various iterations of Windows ever since. It didn't need a 64-bit address space so I never bothered to migrate it to the 64-bit apis.
Until Win 10 came along, I could type < the first few letters of my app's name> and the app would run.
In Win 10, I have to double click on the app to get it to run. If I try the app's folder and its contents show in the start menu but not the app itself. I look under all apps and the app isn't there. I've added a shortcut to the start menu but even that hint isn't enough for Windows to find the app. I tried creating a bat file that would fire off the app and placed the bat file in Programs Folder but that failed.
I never wrote an installer for the app. The app lives in its own folder which I create by dragging it from a CD or network drive as I have migrated between all the Windows iterations since Win-98.
Is there now some xml file I must create that says "This is an app. Please Microsoft, include it in the start menu?" I had thought *.exe would suffice but apparently not. Perhaps *.exe code must now reside in Programs Folder, no exceptions allowed?
If it makes any difference, the application is written in C and compiled in Visual Developer 2008. It reads kid's handwritten responses to arithmetic questions.
More info I've dug up...
I noticed that Python shows up in Windows search but PHP doesn't. IIRC, I installed python with an installer whereas php was unzipped into its current location.
That establishes that a program need not reside in C:\Program Folder to show up in Start-search.
Then I discover that Python has a shortcut in C:\ProgramData\Microsoft\Windows\Start Menu\Programs but PHP doesn't. "That's it!" I think. Nope. Start-search now shows the folder I placed there but not the shortcut to the program. So residence in the start menu folder doesn't do it.
I am obnoxed.
..even more info...
I recompiled the entire project and now search finds the executable which suggests start-search is broken. Moreover, start-search only displays the app if I completely type its name. In Win 7, just the first few letters suffice as is the case with most executables in win10.
The app still doesn't appear in the all apps section but then again, neither do the autodesk apps I have installed. OTOH, the autodesk apps appear by typing just a few letters.
At this point, it appears win10 start-search is broken.
Most .exe files don't appears in Windows Search under Win10 unless they are installed in program files folder... I try to find a way to circumvent this limitation cause lot of my files are portable applications on another drive.
In meantime here's a Workaround: Make a folder "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\DummyApps" and copy the shortcut of the app you want to be listed in "Search Results" in the DummyApps folder.
I've made a shorcut of "DummyApps" on my desktop to drop shortcut of programs I want to access by the search.
Regards
When you say
I've added a shortcut to the start menu but even that hint isn't enough for Windows to find the app
do you mean that you added a shortcut here: C:\ProgramData\Microsoft\Windows\Start Menu\Programs ?
If so, did you restart your pc (or at least explorer.exe)?
Adding a shortcut to the location above and restarting explorer.exe worked for me and it even added the app to the recently added apps section. Hopefully that helps.
step 1:win10 +x, open cmd adminstration mode
step 2:input 'start powershell' in cmd
step 3:input 'Get-AppXPackage -Name Microsoft.Windows.Cortana | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}' in powershell

Play music file using Batch?

I am very confused as to how one would go about this. I want to use Batch to start an .mp3 file and while typing start file.mp3 plays the file, it opens the Media Player to do so. How would I play a music file in the background, but also have the ability to stop it whenever I please?
Windows Media Player with all its bells and whistles is not suitable for noninteractive listening. Use older version instead, which opens just a small window with a few necessary controls, plays the file and exits:
Mplay32.exe /Play /Close "file.mp3"
You may find more inspiration at
http://vitsoft.info/skimid3.htm#TalkingPlayer

Can you run AIR apps from command line?

The question ultimately aims at answering this question: can a batch script run an AIR app? The goal is to setup an AIR app on a web server and make it run through batches. I simply have to know whether this is possible by default or not. Thanks.
Oliver Goldman from Adobe posts how to launch an application from the command line:
On Windows and Linux, invoking
AIR-based applications at the command
line is straightforward. On Windows,
inside the application's install
directory you'll find an executable
with the application's name; that's
the thing to run from the command
line. On Linux, the executable is
inside the "bin" subdirectory.
On Mac OS things are slightly
trickier. In Finder, applications
appear to be a single file, but
they're really a folder with with an
extension of ".app" and a particular
interior folder structure. To launch
them from the command line with
arguments, you have to dig into this
structure and find the executable. For
example, to launch an application
named HelloWorld you'd run:
/Applications/HelloWorld.app/Contents/MacOS/HelloWorld
You can also use the AIR Debug Launcher. It allows you to launch the application from the command line based on its application.xml file without requiring it to be installed.

Resources