我想编写一个Powershell命令以使用Get-Content命令从文本文件读取。 但是Get-Content仅在Windows Powershell上有效,而在使用它的脚本上则无效。
这是使用该命令并由powershell本身执行的脚本。
Get-Content "C:\Users\thang.hoang\Desktop\New folder\New folder\New folder - Copy\ProjectName.txt"
read -p "Enter to continue"
它根本不起作用。要运行该命令我会错过吗?
答案 0 :(得分:0)
我感觉脚本文件格式有问题... 就像我看到的那样,您调用。\ test2.sh并不是有效的powershell脚本结尾。 如果要将脚本作为Powershell脚本执行,请尝试以.ps1结尾。