tipo texto saber que puedo programas programa para lista extensiones extension cómo con como archivos archivo abrir file batch-file

file - texto - Lote: Eliminar extensión de archivo



programas para abrir archivos de todo tipo (4)

Tengo el siguiente script por lotes de Wikipedia:

@echo off for /R "C:/Users/Admin/Ordner" %%f in (*.flv) do ( echo %%f ) pause

En el for-loop, todos los archivos con la extensión flv se hacen eco, pero quiero hacer algunas acciones con el archivo (s) donde necesito una vez el archivo sin la extensión y una vez con la extensión. ¿Cómo podría obtener estos dos?

Busqué soluciones pero no encuentro ninguna. Soy un novato real en lote ...


En caso de que no exista realmente el archivo que contiene su variable, el enfoque FOR no funcionará. Un truco que podría usar, si conoce la longitud de la extensión, es tomar una subcadena:

%var:~0,-4%

el -4 significa que los últimos 4 dígitos (presumiblemente .ext ) se truncarán.


Esta es una respuesta muy tardía, pero se me ocurrió esto para resolver un problema particular que tenía con DiskInternals LinuxReader que agregaba ''.efs_ntfs'' a los archivos que guardaba en directorios que no eran NTFS (FAT32):

@echo off REM %1 is the directory to recurse through and %2 is the file extension to remove for /R "%1" %%f in (*.%2) do ( REM Path (sans drive) is given by %%~pf ; drive is given by %%~df REM file name (sans ext) is given by %%~nf ; to ''rename'' files, move them copy "%%~df%%~pf%%~nf.%2" "%%~df%%~pf%%~nf" echo "%%~df%%~pf%%~nf.%2" copied to "%%~df%%~pf%%~nf" echo. ) pause


Puede usar %%~nf para obtener el nombre de archivo solo como se describe en la referencia de for :

@echo off for /R "C:/Users/Admin/Ordner" %%f in (*.flv) do ( echo %%~nf ) pause

Las siguientes opciones están disponibles:

Variable with modifier Description %~I Expands %I which removes any surrounding quotation marks (""). %~fI Expands %I to a fully qualified path name. %~dI Expands %I to a drive letter only. %~pI Expands %I to a path only. %~nI Expands %I to a file name only. %~xI Expands %I to a file extension only. %~sI Expands path to contain short names only. %~aI Expands %I to the file attributes of file. %~tI Expands %I to the date and time of file. %~zI Expands %I to the size of file. %~$PATH:I Searches the directories listed in the PATH environment variable and expands %I to the fully qualified name of the first one found. If the environment variable name is not defined or the file is not found by the search, this modifier expands to the empty string.


También soy un extraño para windows cmd, pero prueba esto:

echo %%~nf