使用powershell only work on powershell screen命令读取文本文件,但不从脚本读取
我想编写一个powershell命令,以便使用Get Content命令从文本文件中读取。 但是Get内容仅在windows powershell上有效,而不适用于使用它的脚本 这与使用该命令并由powershell本身执行的脚本相同使用powershell only work on powershell screen命令读取文本文件,但不从脚本读取,powershell,Powershell,我想编写一个powershell命令,以便使用Get Content命令从文本文件中读取。 但是Get内容仅在windows powershell上有效,而不适用于使用它的脚本 这与使用该命令并由powershell本身执行的脚本相同 Get-Content "C:\Users\thang.hoang\Desktop\New folder\New folder\New folder - Copy\ProjectName.txt" read -p "Enter to continue" 它根
Get-Content "C:\Users\thang.hoang\Desktop\New folder\New folder\New folder - Copy\ProjectName.txt"
read -p "Enter to continue"
它根本不起作用。我是不是错过了运行命令的机会?我感觉脚本文件格式有问题。。。 我可以看到您调用了。\test2.sh,这不是有效的powershell脚本结尾。
如果要将脚本作为powershell脚本执行,请尝试以.ps1结尾。Bash不知道powershell cmdlet。是否有理由将其保存为
.sh
而不是.ps1?谢谢您,因为从一开始我就想制作一个bash文件,只需稍加修改即可从windows和mac同时运行。现在我才意识到powershell和bash是不同的东西。