VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Member
    Join Date
    Mar 2003
    Location
    China
    Search Comp PM
    Usually i find an answer to any mpc questions by searching around awhile, but after hours I'm still stumped if what im trying to do is even possible...

    I'm trying to launch mpc-hc from a command line and have it automatically resume playback of the most recent file.

    Is that possible? So far, launching it is easy from a command prompt. However, after that, I must physically click the "play" button for it to resume playback of the last file that was played. Is there a way I can trigger this from the command prompt as well?

    Here's hoping...
    Quote Quote  
  2. The "/startpos 0:0:0" switch works to resume playing when you supply a filename on the command line.
    Code:
    mpc-hc64 /startpos 0:0:0 filename.mp4
    But it doesn't work when resuming the last video. You can work around that by getting the last filename from the registry. From a batch file you can do this:

    Code:
    for /f "tokens=2,*" %%a in ('reg query "HKEY_CURRENT_USER\Software\MPC-HC\MPC-HC\Recent File List" /v "File1" ^| findstr "File1"') do ( set LAST_NAME=%%b )
    "G:\program files\MPC HomeCinema (x64)\mpc-hc64" /startpos 0:0:0 "%LAST_NAME%"
    You may need to change the registry location if your version of MPCHC stores it in a different location. And you'll need to change the path to MPCHC. The "Remember File Position" option in MPCHC must be enabled.
    Quote Quote  
  3. Member
    Join Date
    Mar 2003
    Location
    China
    Search Comp PM
    THANK YOU! You are amazing, wonderful, a God sent even. Been trying to find a way for ages, and I knew it most likely had to do with understanding registry tokens or what not but there was no way I was going to learn how to do that anytime soon. What you told me works perfectly. Thanks a ton!
    Quote Quote  
  4. Member
    Join Date
    Mar 2003
    Location
    China
    Search Comp PM
    May I ask one more follow up if you don't mind? What's the command I can add at the end of the batch file that will close the msdos window?

    Nevermind. After a bit more research, I found the solution was to add '| taskkill /F /IM cmd.exe' at the end. All is perfect now. Thanks again.
    Last edited by Spixe; 12th Jul 2017 at 12:03. Reason: found answer.
    Quote Quote  
  5. I had to do a little research too. After figuring out MPCHC wouldn't automatically continue without supply a filename I search through the Registry for MPCHC's recent file list. Then I searched for methods of getting Registry keys in a batch file. Finally, I simplified the examples I found.

    To automatically close the CLI window change the second line to:

    Code:
    Start /b "Window Title" "G:\program files\MPC HomeCinema (x64)\mpc-hc64" /startpos 0:0:0 "%LAST_NAME%"
    Last edited by jagabo; 12th Jul 2017 at 12:13.
    Quote Quote  
  6. Member
    Join Date
    Mar 2003
    Location
    China
    Search Comp PM
    Interesting. During my research, or also just in what I've come up with in the past, I knew I could use "start /b" to close the window when finished - but in this case, I couldn't get "start" to work for me. Usually it's a simple as putting the exe outside the quotes (with the quotes just pertaining to the directory), but it wouldn't take this time. Funny how what it took was a "Window Title" for that to work... I've no idea why that is, but I'm not certainly not complaining. I reckon it's safer than using taskkill too. Thanks for the lesson in batch files.
    Quote Quote  
  7. The first argument after Start is normally the name of the new window. Even when using the /b switch it seems to like having the window name. Without it I think Start was using the "\path\to\mpchc" as the window name and assuming /startpos was another argument to Start, not an argument to be passed to MPCHC. It took me a while to figure that out too. Of course, you can use any text you want, not just "Window Title".
    Quote Quote  
  8. Member
    Join Date
    Mar 2003
    Location
    China
    Search Comp PM
    Ha, funny, because I did actually just try inserting "" after /start, just as an experiment. Turns out all I had to do was ad ANYTHING between there. Nevertheless, I couldn't have got it working without ya, so again, much obliged. Wish I could give you a "rep" +1 or something.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!