我想在属性中设置名称值对的变量.属性文件有#作为注释
====示例输入文件=====
#This is a comment
### Another comment
appNames=HelloWorldApp
targetServer=serverABC
DEV.key1=value1
TEST.key2=value2
Run Code Online (Sandbox Code Playgroud)
=========我有2个问题
1)
C:\temp\dos>for /f "delims=" %i in (test.properties) do @set %i
Environment variable #This is a not defined
Environment variable ### Another not defined
Run Code Online (Sandbox Code Playgroud)
变量已设置,但我希望忽略注释.我想用一行代码执行此操作,但请改为使用.
for /f "delims=" %i in (test.properties) do @echo %i | find "#">nul || @set %i
find: unable to access "#": The system cannot find the file specified.
The process tried to write to a nonexistent pipe.
Environment variable #This is a not …Run Code Online (Sandbox Code Playgroud) batch-file ×1