Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 获取批处理文件中文本文件的前两个字符串_String_Batch File_Cmd - Fatal编程技术网

String 获取批处理文件中文本文件的前两个字符串

String 获取批处理文件中文本文件的前两个字符串,string,batch-file,cmd,String,Batch File,Cmd,我有一个包含如下数据的文本文件,但我只想获取文件的前两个字符串。 由此: Caption SMI USB DISK USB Device Hitachi HTS547550A9E384 为此: Caption SMI USB DISK USB Device 如果你有powershell,你可以通过 powershell -command "& {get-content fil

我有一个包含如下数据的文本文件,但我只想获取文件的前两个字符串。 由此:

Caption                           
SMI USB DISK USB Device    
Hitachi HTS547550A9E384  
为此:

Caption                      
SMI USB DISK USB Device

如果你有powershell,你可以通过

powershell -command "& {get-content filename -totalcount n}"

其中
n
是要显示的行数。

如果您有powershell,可以通过

powershell -command "& {get-content filename -totalcount n}"

其中
n
是要显示的行数。

如果您有powershell,可以通过

powershell -command "& {get-content filename -totalcount n}"

其中
n
是要显示的行数。

如果您有powershell,可以通过

powershell -command "& {get-content filename -totalcount n}"
其中
n
是要显示的行数。

非常简单:

@echo off
3<text.txt (
set /p line1= <&3
set /p line2= <&3
)
Echo %line1%
Echo %line2%
@echo关闭
3非常简单:

@echo off
3<text.txt (
set /p line1= <&3
set /p line2= <&3
)
Echo %line1%
Echo %line2%
@echo关闭
3非常简单:

@echo off
3<text.txt (
set /p line1= <&3
set /p line2= <&3
)
Echo %line1%
Echo %line2%
@echo关闭
3非常简单:

@echo off
3<text.txt (
set /p line1= <&3
set /p line2= <&3
)
Echo %line1%
Echo %line2%
@echo关闭



3我并没有尝试过任何东西,因为我不知道批处理脚本@zb226See在批处理*nix
head
实用程序中的准实现。我并没有尝试过任何东西,因为我不知道批处理脚本@zb226See在批处理*nix
head
实用程序中的准实现。我并没有尝试过任何东西因为我不知道批处理脚本@zb226See在批处理*nix
head
实用程序中的准实现。因为我不知道批处理脚本@zb226See在批处理*nix
head
实用程序中的准实现,所以我并没有尝试过任何东西。但我并没有PowerShell你们试过吗?您有什么版本的Windows?我如何才能将其输出到txt文件?使用
>文件名
(创建新文件)或
>文件名
(在(非)现有文件末尾添加),但我没有PowerShell。您尝试过吗?您有什么版本的Windows?我如何才能将其输出到txt文件?使用
>文件名
(创建新文件)或
>文件名
(在(非)现有文件末尾添加),但我没有PowerShell。您尝试过吗?您有什么版本的Windows?我如何才能将其输出到txt文件?使用
>文件名
(创建新文件)或
>文件名
(在(非)现有文件末尾添加),但我没有PowerShell。您尝试过吗?您有什么版本的Windows?如何将其输出到txt文件?使用
>文件名
(创建新文件)或
>文件名
(在(非)现有文件末尾添加)为什么会出现这样的错误3'不被识别为内部或外部命令、可操作程序或批次file@user352156哎哟,意外间隔,间隔是多少@monacraft@user352156看看我编辑的代码。现在是功能性的,我的输出是这样的:——†ഠ䔊䡃⁏獩漠晦മ为什么我会犯这样的错误?”3'不被识别为内部或外部命令、可操作程序或批次file@user352156哎哟,意外间隔,间隔是多少@monacraft@user352156看看我编辑的代码。现在是功能性的,我的输出是这样的:——†ഠ䔊䡃⁏獩漠晦മ为什么我会犯这样的错误?”3'不被识别为内部或外部命令、可操作程序或批次file@user352156哎哟,意外间隔,间隔是多少@monacraft@user352156看看我编辑的代码。现在是功能性的,我的输出是这样的:——†ഠ䔊䡃⁏獩漠晦മ为什么我会犯这样的错误?”3'不被识别为内部或外部命令、可操作程序或批次file@user352156哎哟,意外间隔,间隔是多少@monacraft@user352156看看我编辑的代码。现在是功能性的,我的输出是这样的:——†ഠ䔊䡃⁏獩漠晦മ