-1

I am running powershell from batch script. Here is sample code.

   powershell.exe Set-ExecutionPolicy Bypass -Force
   set logDir=C:\testfolder\
   mkdir %logDir%
   powershell.exe C:\<folder>\test.ps1 >> "%logDir%test.log"

Getting error: "test.ps1" is not recognized as the name of a cmdlet This issue occurred only on particular VM. The same script execution completes on other windows machines. Need solution for this issue.

0

1 Answer 1

0

whenever I want powershell.exe to execute a ps1 file I use the following syntax:

powershell.exe -f "C:\<folder>\test.ps1"

telling the exe to execute a file not a Cmdlet.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.