작업 스케줄러에서 PowerShell 스크립트를 실행하는 데 문제가 있습니다. PowerShell ISE에서 스크립트를 만들었으므로 제대로 작동합니다.PowerShell vs PowerShell ISE
그러나 PowerShell에서 실행할 때 실수가 있다고보고합니다.
왜 이러한 일이 발생할 수있는 아이디어가 있습니까?
나는
powershell_ise.exe -File D:\script.ps1
또는
powershell.exe -File D:\script.ps1
에 단 한 줄의 파일을 만들려고했지만 그 어느 것도 작동합니다. 정책을 확인했지만 제한이 없습니다.
나는 PowerShell을 ISE에서
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -Command d:\Script.ps1
를 실행하려고하고 그것을 잘 작동합니다. 내가 PowerShell에서 실행하면
는 오류 보여줍니다 -format에 대한
The term '▬' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1
$datetime = Get-Date -f yyyMMdd
$strFileName = "c:\test\BS_" + $datetime + ".txt"
if (Test-Path $strFileName) {
exit
} else {
exit
}
...
'몇 가지 실수를보고합니다.'라는 오류 메시지가 무엇인지 궁금합니다. 그것들이 그 문제와 관련이 없다고 생각하는 것 같습니다. 왜 그런가요? – vonPryz
.ps1 파일이 대시'- '로 시작합니까? – vonPryz
아니요, BS_test.ps1 – HeadOverFeet