DOS BAT文件等同于Unix的基本名称的命令? [英] DOS BAT file equivalent to Unix basename command?
问题描述
有一个简单的方法去使用DOS BAT命令语言DOS文件名的基本名(不带扩展名文件名)?
Is there an easy way to get to the basename (file name without extension) of a DOS file name using the DOS BAT command language?
我同意: FORMAT C:\\
可能是一个良好的开端,随后启动的Linux CD(假设这些古董机器有CD读取器 - 而不是一个给定的)。但是,让我们pretend,我们只有DOS ...(这意味着:无法在Windows - 甚至没有的Windows 3.1,更不用说Windows 95中,98,NT,ME,XP,Vista中,7等)
I agree: format c:\
is probably a good start, followed by a bootable Linux CD (assuming these antique machines have a CD reader - not a given). But let's pretend that we only have DOS... (That means: not Windows - not even Windows 3.1, let alone Windows 95, 98, NT, ME, XP, Vista, 7, etc.)
推荐答案
对于命令行
for /F %i in ("c:\foo\bar.txt") do @echo %~ni
输出:栏
对于.bat文件
set FILE="c:\foo\bar.txt"
for /F %%i in ("%FILE%") do @echo %%~ni
输出:栏
延伸阅读:
http://www.computerhope.com/forhlp.htm
这篇关于DOS BAT文件等同于Unix的基本名称的命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!