As a favour, I'm compiling a number of videos on a DVD. They're all different resolutions, codecs and containers. To save myself sometime I thought I'd just bundle in MPC and have a batch script launch them. I was told they need an icon and since there's no way to make dynamic shortcuts in Windows using %CD%
, as far as I could find.
Very simple batch script:
START "" "%cd%\MPC-HC\mpc-hc.exe" "%cd%\VideoFiles\01.mp4"
So I've tried a few BAT to EXE apps and fo开发者_运维问答und that they really just decompress the BAT and run it. They use %CD%
as their temp folder which makes it impossible to launch from a disc.
So I found ExeScript and I can alter the temp directory... Only problem? The BAT then launches from there then, meaning%CD%
is useless.
So once again I alter the batch file to sniff out the disc drive:
for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%a:\01.exe
set rundir=%%a:
START "" "%rundir%\MPC-HC\mpc-hc.exe" "%rundir%\VideoFiles\01.mp4"
This works well enough (causes an error if disc trays are open or empty), however if the files are copied to the HDD, then it doesn't as it'll try to read from the CD. There's no way of knowing if it's being launched from a hard drive or disc.
At this point I'd even appreciate help on how to write something like this in C and avoid batch files all together (and thus the temp file mess).
I've solved this by putting on a version for from the drive and one for from the HDD. Easiest solution.
What about relative folder paths?
START "" "MPC-HC\mpc-hc.exe" "VideoFiles\01.mp4"
That should work on HDD and CD alike.
精彩评论