简体   繁体   English

批量替换powershell命令

[英]replace powershell command inside a batch

I have a batch file to change a csv file to a txt file and I need to "embed" the powershell commands above into this batch file. 我有一个批处理文件,将csv文件更改为txt文件,我需要将上面的powershell命令“嵌入”到该批处理文件中。 In this case, I can't use a .ps1 file.... 在这种情况下,我不能使用.ps1文件...。

${c:\file.csv} = ${c:\file.csv} -replace ','
${c:\file.csv} = ${c:\file.csv} -replace '"', ''

Can you help me, please? 你能帮我吗?

Thanks in advance, Fabi 预先感谢,法比

如果允许打开Powershell进程,则可以将其放入批处理文件中

echo . | powershell -executionpolicy bypass -command "&{ read-host 'do powershell stuff here' }"

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

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