我希望我的程序显示带有类型的文本文件的内容,但文本文件位于不同的目录中。所以我试过
type folder/file.txt
并且它说命令语法不正确。
答案 0 :(得分:0)
我能做的是
set directory=%cd%
cd folder
type file.txt
cd %directory%
但是知道如何在类型之后以某种方式精确化目录会很好。
答案 1 :(得分:0)
我不明白为什么你不能简单地使用:
Type "folder\file.txt"
如果它不起作用你确定该文件有内容并且存在于该位置吗? (由于您未使用完整路径,folder\file.txt
必须与当前工作目录相关。)
您也可以尝试DPath
命令:
DPath C:\folder
Type file.txt
用法:的
DPATH pathname [;pathname] [;pathname] [;pathname]...
DPATH
DPATH ;
pathname : drive letter and/or folder
; : the command 'DPATH ;' will clear the path