对于空间/˚F处理文件名 [英] For /f processing filename with spaces

查看:219
本文介绍了对于空间/˚F处理文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的一个文件中的每一行进行一些处理。

I want to do some processing on each line of a file.

for /f "delims=" %%i in ("%RF_PROPERTIES%") do (          
   echo %%i
)

我RF_PROPERTIES点与空格的文件路径(C:\\ Program Files文件\\阿科特系统\\的conf \\ rf.properties)。据抱怨说,环境变量C:没有定义\\ Program Files文件\\阿科特,尽管我已经提供报价。如何获得它的工作?

My RF_PROPERTIES points to a file path with spaces (c:\program files\Arcot systems\conf\rf.properties). It is complaining saying Environment variable C:\Program Files\Arcot not defined, even though I have provided quotes. How to get it working?

推荐答案

尝试添加有usebackq 选项:

for /f "usebackq delims=" %%i in ("%RF_PROPERTIES%") do (          
  echo %%i
)

的输出解释/

有usebackq - 指定
  新的语义已经生效,
                    其中,一个后引号的字符串作为一个执行
                    命令和单引号字符为
                    文字字符串命令和允许使用
                    双引号引用的文件名
                    文件集。

usebackq - specifies that the new semantics are in force, where a back quoted string is executed as a command and a single quoted string is a literal string command and allows the use of double quotes to quote file names in file-set.

这篇关于对于空间/˚F处理文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆