Hi, I am new to power shell.
I wrote a simple code to echo out the current time with message. This works fine inside powershell_ise but when i try to run this script from a cmd file, an error is given.
The term 'main' is not recognized as the name of a cmdlet, function, script fil
e, or operable program. Check the spelling of the name, or if a path was includ
ed, verify that the path is correct and try again.
+ main <<<<
+ CategoryInfo : ObjectNotFound: (main:String) , CommandNotFoun
+ FullyQualifiedErrorId : CommandNotFoundException
cmd line script
powershell -file "./deploySite.ps1" > result.log
Content of deploySite.ps1 is as follows
outlog "Initiate deployment"
$output = ( get-date ).ToString('yyyyMMdd hh:mm:ss') + " $message"
Could someone please tell me why I get this error when running from cmd and how to fix this issue? thank you