在Windows 2003中删除批处理程序中的双引号 [英] Removing double quotes in a batch program in Windows 2003
问题描述
我刚刚过去了一个开始的配料机(可能更像是一个屠夫),并且已经为此斗争了太久了(我找到了一些建议并对其进行了尝试,但似乎无法使它们中的任何一个起作用-可能UE)。我在Windows 2003计算机上创建了一个文件,该文件带有一个批处理文件(dir_list.txt),如下所示:
I'm just past a beginning batcher (probably more like a butcher) and have been fighting with this far too long (I've found some suggestions and tried them but can't seem to make any of them work - probably UE). I have a file on a Windows 2003 machine that I created in with a batch file (dir_list.txt) that looks like:
"t001wp"
"w003th"
"b005ku"
"k009dp"
.
.
.
.
我想删除双引号。预先感谢您的帮助。
I want to strip out the double quotes. Thanks in advance for any help.
推荐答案
搜索 for命令的帮助,答案就在帮助的底部。 。 %%〜i将自动删除引号。如果带引号的文本中有空格,则需要使用 tokens = *来捕获带引号的整个字符串。希望这会有所帮助。
Search help for the "for" command and the answer is near the bottom of the help. The %%~i will automatically strip the quotes. If there are spaces in the quoted text you will need to use "tokens=*" to capture the entire string in quotes. Hope this helps.
@echo off
for /f "tokens=*" %%i in (x) do echo %%~i
这篇关于在Windows 2003中删除批处理程序中的双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!