嗨,我有一个文件,其数据类似
Link: tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2800
Link: tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2801
Link: tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2802
Link: tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2803
Link: tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2804
在这里我要打印删除链接的行:像这样的字
tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2800
tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2801
tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2802
请帮助我..
答案 0 :(得分:0)
您应该使用PowerShell而不是命令行。
将该链接分配给一个字符串,并从中提取一个子字符串。
这是我通过Google的快速搜索找到的指南:https://4sysops.com/archives/strings-in-powershell-replace-compare-concatenate-split-substring/
答案 1 :(得分:0)
尝试此代码。
将以下代码复制到文本文件中,然后保存文件filename.cmd并从命令提示符处运行文件。
@echo off
setlocal enabledelayedexpansion
for /F "tokens=*" %%A in (input.txt) do (
set line=%%A
echo !line:~6! >> output.txt
)
input.txt
Link: tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2800
Link: tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2801
Link: tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2802
Link: tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2803
Link: tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2804
在output.txt中得到结果
tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2800
tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2801
tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2802
tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2803
tds://ACC.GA.mfqc.ams1907.com:8443/qcbin//TestLabModule-000000003649890581?EntityType=IRun&EntityID=2804