Tools and other software Batch File Archive (1 Viewer)


MP Donator
  • Premium Supporter
  • September 12, 2009
    Germany Germany
    Country flag
    im running small batch files on my HTPC on resume to handle stuff like backups and starting epg grabbing. I thought i would share them. Also i think its a nice idea to start a thread where everybody can share their batchfiles, so when somebody is looking for a specific solution they can find it here.

    I hope others will add their batch scripts here aswell, and i will then link them directly in this post. Please dont add them as files, but as text in code tags.

    Batch Scripts:
    • - Allow to start a batch file only once a day
      @echo off 
      set LastDate=C:\LastDate.txt 
      set TempDate=C:\Date.tmp 
      if exist %TempDate% exit
      echo %date%>%TempDate%
      fc %TempDate% %LastDate% >nul
      if %ERRORLEVEL%==1 goto NewDay
      goto End
      :: What to do
      move %TempDate% %LastDate%
    • - Backup Files (e.g. Mediaportal Databases)
      :: Backing up everything from D:, and keeping the backups for 7 days.
      xcopy D:\*.* D:\temp\ /y/q
      FOR /F "tokens=1,2 delims=:" %%d IN ('date /t') DO set dat=%%d
      FOR /F "tokens=1,2 delims=:" %%i IN ('time /t') DO set zeit=%%i-%%j
      rename D:\temp "Backup %dat%%zeit%"
      FOR /F "skip=7 tokens=*" %%c IN ('DIR /O-D /B D:\"Backup *"') DO (rd D:\"%%c" /s/q)
    • - Start WebGrab++ and keep TVServer from going crazy
      "C:\Program Files (x86)\ServerCare\WebGrab+Plus\WebGrab+Plus.exe"
      xcopy "C:\ProgramData\Team MediaPortal\MediaPortal TV Server\xmltv\temp.xml" "C:\ProgramData\Team MediaPortal\MediaPortal TV Server\xmltv\tvguide.xml" /Y
    • Comskip by @eisblock
    • Copy ClearArt and ClearLogos to Mediaportal folders by @ixdvc
    • Backup local fanart by @ixdvc
    Last edited:


    Portal Pro
    March 19, 2010
    SET CS_PATH=C:\Programme\Comskip
    SET CS_DEF_INI=--ini="%CS_PATH%\Channel_ini\_default.ini"
    CALL :comskipstart %1 %2
    GOTO :ende
    :: ini festlegen
        IF EXIST "%CS_PATH%\Channel_ini\%~2.ini" (
            SET CS_DEF_INI=--ini="%CS_PATH%\Channel_ini\%~2.ini"
    :: Logo festlegen, falls gewünscht
    REM     IF EXIST "%CS_PATH%\Channel_logo\%~2.logo.txt" (
    REM         SET CS_LOGO=--logo="%CS_PATH%\Channel_logo\%~2.logo.txt"
    REM     )
    :: Log Ausgabe   
        ECHO.FILE....: %1 >"%~dpn1.bat.log"
        ECHO.CHANNL..: %2    >>"%~dpn1.bat.log"
        ECHO.INI.....: %CS_DEF_INI% >>"%~dpn1.bat.log"
        ECHO.LOGO....: %CS_LOGO% >>"%~dpn1.bat.log"
        ECHO.........: comskip.4.bat, startet nun comskip.exe :........ >>"%~dpn1.bat.log"
    :: Kopiere Timeshift
    ::    START /MIN  %CS_PATH%\CopyTimeshift.bat "%~1"
    :: execute comskip --debugwindow .... START
        %CS_PATH%\comskip.exe --ts %CS_DEF_INI% %CS_LOGO% %1
    GOTO :ende


    Portal Pro
    May 26, 2009
    Germany Germany
    Country flag
    I use Ember Media Manager to scrape nfos and fanart for my TV shows. I also like to download clearart and clearlogos directly from to select the ones I like best and save them to the show folders. Then the XBMC clients are able to find them.
    So I wrote a batch file to copy those cleararts and clearlogos to the MePo thumbs folder. The files have to be renamed to the show id which is read from tvshow.nfo in the show folder.

    Make a backup of your current cleararts and clearlogos from
    C:\ProgramData\Team MediaPortal\MediaPortal\thumbs\ClearArt\
    C:\ProgramData\Team MediaPortal\MediaPortal\thumbs\ClearLogo\
    C:\ProgramData\Team MediaPortal\MediaPortal\thumbs\TVSeries\ClearArt\
    C:\ProgramData\Team MediaPortal\MediaPortal\thumbs\TVSeries\ClearLogo\
    as those are overwritten without question.
    @echo off
    set thumbspath=C:\ProgramData\Team MediaPortal\MediaPortal\thumbs
    IF exist "%thumbspath%\ClearArt\Series" ( echo %thumbspath%\ClearArt\Series exists ) ELSE ( mkdir "%thumbspath%\ClearArt\Series" && echo %thumbspath%\ClearArt\Series created )
    IF exist "%thumbspath%\ClearLogo\Series" ( echo %thumbspath%\ClearLogo\Series exists ) ELSE ( mkdir "%thumbspath%\ClearLogo\Series" && echo %thumbspath%\ClearLogo\Series created )
    IF exist "%thumbspath%\TVSeries\ClearArt\FullSize" ( echo %thumbspath%\TVSeries\ClearArt\FullSize exists ) ELSE ( mkdir "%thumbspath%\TVSeries\ClearArt\FullSize" && echo %thumbspath%\TVSeries\ClearArt\FullSize created )
    IF exist "%thumbspath%\TVSeries\ClearLogo\FullSize" ( echo %thumbspath%\TVSeries\ClearLogo\FullSize exists ) ELSE ( mkdir "%thumbspath%\TVSeries\ClearLogo\FullSize" && echo %thumbspath%\TVSeries\ClearLogo\FullSize created )
    set seriesfolder=%~dp0
    for /D %%G in (*) do (
        pushd %%G
        set series=%%G
        REM if %cd%==%seriesfolder% goto :eof
        call :getid
    FOR /F "tokens=1-2 delims=<>, " %%I in (tvshow.nfo) do (
        REM echo %%I
        if %%I==id (
            set tvshowid=%%J
            goto :copying
    echo ID for %series% is %tvshowid%. Copying images.
    copy "clearart.png" "%thumbspath%\clearart\Series\%tvshowid%.png"
    copy "logo.png" "%thumbspath%\clearlogo\Series\%tvshowid%.png"
    copy "clearart.png" "%thumbspath%\TVSeries\ClearArt\FullSize\%tvshowid%.png"
    copy "logo.png" "%thumbspath%\TVSeries\ClearLogo\FullSize\%tvshowid%.png"
    cd %~dp0
    And I have another batch file to backup my local fanart (all png and jpg files from the show folder). The backup folder can be set in the second line:
    @echo off
    set backuppath=C:\fanartbkp
    IF exist "%backuppath%" ( echo %backuppath% exists ) ELSE ( mkdir "%backuppath%" && echo %backuppath% created )
    set seriesfolder=%~dp0
    for /D %%G in (*) do (
        pushd %%G
        set series=%%G
        REM if %cd%==%seriesfolder% goto :eof
        call :copying
    echo Copying images for %series%.
    IF exist "%backuppath%\%series%\" ( echo %backuppath%\%series%\ exists ) ELSE ( mkdir "%backuppath%\%series%\" && echo %backuppath%\%series%\ created )
    copy "*.png" "%backuppath%\%series%\"
    copy "*.jpg" "%backuppath%\%series%\"
    cd %~dp0
    Both batch files are meant to be run from your base TV show path, it should be like that:
    TV Shows
    |----TV Show 1
    | |--clearart.png
    | |--logo.png
    |----TV Show 2
    | |--files
    And those batch files do not like to be run from UNC paths. So your folder has to be mounted as a network drive at least temporarily.

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    D Downloading EPG XML file: Installation, configuration support 0
    M [solved] WTV Files does not play on client, MPEG files works well General 1
    bigboss97 Does anyone has a SoundGraph imon remote file for MP2 to share? General 0
    J Help with new grabber file. WebEPG 1
    S [solved] No sound - MKV file MediaPortal 1 Talk 2
    G WTV files General 11
    Golf4 TV-Records werden als Audio-Files importiert ? Allgemeines Support- und Diskussionsforum 0
    azzuro [fixed] [WIP MP2.3] - Audio files not imported to MP MediaPortal 2 18
    HTPCSourcer Media Accessor is flooding logs with files from attached monitor MediaPortal 2 9
    R [will not fix] [MP2-832] MP2.2.2 subtitles not shown for WTV files Submit: Bug Reports 7
    R [solved] Files moved to new location - Easy way to update database? My TVSeries 7
    R Files moved to different location - Easy way to update database? Moving Pictures 2
    thepahakurki Trakt error: Invalid or missing file Trakt 8
    M Keymapping Which File To Edit General Support 4
    F No data in "File Details" Moving Pictures 2
    R [solved] Moving pictures importer wont add files from a removable drive. Is there a work around ? Moving Pictures 8
    R Directx 9.0 June 2010 does not install on Windows 10 x64, ends up with weird failure / no debug file Installation, configuration support 0
    B xml file for perfect player Newcomers Forum 1
    K How to enable autoplaying of the next video files in the folder MediaPortal 1 Talk 2
    B Text files attached to videos Watch / Listen Media 10
    Neoculture Bulk file name update My TVSeries 6
    ge2301 [fixed] [MP2-807] Problem when switching player in PiP mode with audio files MediaPortal 2 32
    C How do I get MediaPortal to separate recording files by channel and month? General 2
    CyberSimian [Bug] Signed/unsigned error in calculation of file timestamps MediaPortal 1 11
    HTPCSourcer [solved] Sometimes persistent issues when playing specific h264 mkv files MediaPortal 2 18
    Similar threads

    Top Bottom