简体   繁体   English

如何替换批处理脚本输出中的文本

[英]How to Replace text in the output from a Batch Script

I have a script I run and this is a sample output:我有一个我运行的脚本,这是一个示例输出:

OK           J:        \\har-fs01\dept
OK           K:        \\erl-tbafs01.tbamerica.com\share 
OK           L:        \\erl-tbafs01\users\dfeist 
OK           N:        \\erl-tbafs01.tbamerica.com\scanneddata 
OK           S:        \\nov-fs02\share

I am trying to replace OK with Net Send and I am having no luck.我正在尝试用 Net Send 替换 OK,但我没有运气。

I have looked at other code and tried Google as well as here and all of the examples are close but even with modding, I cannot get anything to work.我查看了其他代码并尝试了 Google 以及此处的所有示例,但即使使用改装,我也无法得到任何工作。

(Sorry about the text. The webpage formatted it that way. They are seperate lines) (对不起文字。网页是这样格式化的。它们是单独的行)

I was able to use this: for /f "tokens=*" %%a in (My.txt) do (echo Net Use %%a) >> c:\temp\output.txt我能够使用这个: for /f "tokens=*" %%a in (My.txt) do (echo Net Use %%a) >> c:\temp\output.txt

This replaced the text with what I needed and I got the requested results这用我需要的替换了文本,我得到了请求的结果

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM