
Trotzdem danke

Moderators: Hacker, Stefan2, white
Geht kürzer und lässt sich im Dateinamen leichter lesen:Sheepdog wrote:for /f "tokens=1,2,3,4 delims=:," %%i in ("%time%") do set zeit=%%i%%j%%k%%l
Code: Select all
set zeit=%time::=.%
Code: Select all
set zeit=%time::=%
Code: Select all
/c Type %L >>%TDefault.m3u
reicht jetzt das letzte beispiel? oder was muß ich denn alles von den zuletzt genannten beispielen umsetzen?ZoSTeR wrote:Wie wärs mit:
cmd.exeSo werden die ausgewählten Dateien an die bestehende Playlist gehängt.Code: Select all
/c Type %L >>%TDefault.m3u
Code: Select all
@ECHO off
SETLOCAL enabledelayedexpansion
SET listendatei=%1
SET zielpfad=%2
FOR /F %%i in (%listendatei%) do (
SET dateiname=%%i
CALL SET neuerdateiname=%%dateiname:!zielpfad!=%%
ECHO !neuerdateiname! >>!zielpfad!Default.m3u
)
ENDLOCAL
Code: Select all
cmd.exe /c c:\MakePlaylist.cmd
Code: Select all
%L %T
Doch:Vision wrote:Gibt es nicht mehr , oder ?
Dieser Parameter (wie zB %P(-1) =Parent folder) fehlt leider dem TC.alfonso wrote:Genau so eine Möglichkeit suche ich auch.Vision wrote:Ich benutze :
Parameter:"%L" %p\DEFAULT.m3u
Ich möchte aber das Default durch den Namen vom Verzeichnis ersetzt wird. Ich kommt nicht auf den Parameter
Code: Select all
' %L will create an temporary file like "C:\Users\myusername\AppData\Local\Temp\CMDB034.tmp" which holds the list of the selected files.
' %P als beliebig oft erlaubter Parameter bewirkt, dass der Pfad des Quellverzeichnisses in die Kommandozeile gestellt wird (inkl. \ am Ende).
'cscript "this.vbs"
' "this.vbs" Parameter 1: the file to copy, here the %L list
' "this.vbs" Parameter 2: the target file, here %Psomething.m3u
'Example "this.vbs" Para: %L %Psomething.m3u
' Example TC Button:
'TOTALCMD#BAR#DATA
'cscript "%Commander_Path%\VBS\CopyList.vbs"
'"%L" "%Psomething.m3u"
'%Commander_Path%\WCMICONS.DLL,21
'Copy %L list to current folder. Change filename to parent foldername, keep m3u extension.
'
'
'-1
'// THE VB SCRIPT:
On Error Resume Next
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WS = Wscript.CreateObject("WScript.Shell")
if (Wscript.arguments.count <> 2) Then WScript.Quit
sTCtempList = Wscript.arguments.Item(0) ' The TC temp file due the "%L"
sOutputFile = Wscript.arguments.Item(1) ' The TC para "%Psomething.m3u"
If FSO.FileExists(sTCtempList) Then
'// Debug Info:
'MsgBox "Tempfile is: " & sTCtempList '// C:\Users\myusername\AppData\Local\Temp\CMDB034.tmp
'WS.run "notepad " & sTCtempList
'MsgBox "sOutputFile is: " & sOutputFile '// X:\Music\Band\Album\something.m3u
'// Get the parts out of the full file name "%Psomething.m3u"
sFileName = sOutputFile
sPath = mid(sFileName, 1, InStrRev(sFileName, "") -1)
aPathArray = split(sFileName, "")
sName = aPathArray(UBound(aPathArray))
sBase = left(sName, InStrRev(sName,".") -1)
sExte = right(sName, len(sName) - len(sBase) -1)
sParent = aPathArray(UBound(aPathArray) -1)
sGrand = aPathArray(UBound(aPathArray) -2)
sGraGran = aPathArray(UBound(aPathArray) -3)
sDrive = replace(aPathArray( 0),":","")
sTopFld = aPathArray( 1)
sTopFld2 = aPathArray( 2)
'-----------------------------------------------------------
'// TEST OUTPUT:
if ( 1=1 ) Then
ret = MsgBox("FileName " & sOutputFile & vbCRLF _
& "Path: " & vbTab & sPath & vbCRLF _
& "Drive: " & vbTab & sDrive & vbCRLF _
& "TopFld: " & vbTab & sTopFld & vbCRLF _
& "TopFld2: " & vbTab & sTopFld2 & vbCRLF _
& "Parent: " & vbTab & sParent & vbCRLF _
& "GrandP: " & vbTab & sGrand & vbCRLF _
& "Name: " & vbTab & sName & vbCRLF _
& "Base: " & vbTab & sBase & vbCRLF _
& "Ext: " & vbTab & sExte & vbCRLF _
,vbOKCancel,"Debug: Input")
if (ret=vbCancel) Then WScript.Quit
end if
'-----------------------------------------------------------
'// Do your work here:
'copy_file FileName, TargetName
ret = MsgBox("copy_file " & sTCtempList & ", " & sPath & "" & sParent & "." & sExte, vbOKCancel,"Debug: Output")
if (ret=vbCancel) Then
WScript.Quit
else
copy_file sTCtempList , sPath & "" & sParent & "." & sExte
End if
Else
MsgBox "Input file " & sTCtempList & " not found."
End If
'############### Extra Functions ##########################################
'---------------------------------------------------------------------------
' Sub copy_File
' copy_File FileName, TargetName
'---------------------------------------------------------------------------
Sub copy_file(FileName, TargetName)
On Error Resume Next
If FSO.FileExists (FileName) Then
'MsgBox "Copy " & FileName & " zu " & TargetName,,"Debug: copy now"
FSO.CopyFile FileName, TargetName, True 'True=überschreiben
Else
MsgBox FileName & " not found",,"Copy error"
End If
End Sub
'<EOF>