Call powershell script via Batch-File
by kr1999 » Wed, 04 Jul 2007 00:28:11 GMT
Hi everyone,
i wrote a script to sign my powershell scripts. When I call the sign
script with a file to sign any file, the script works fine. But when I
create a batch file to call the powershell script with a file to sign,
I get the error message that no file name was given.
Batch-File:
.\SignFile.ps1 %1%
SignFile.ps1:
Param
(
[string] $File
)
$str = "Filename: " + $File
Write-Output $str
...
How have I to call the powershell script within my batch file to work
as I expect?
Thanks for the help,
Reiner
Re: Call powershell script via Batch-File
by Brandon Shell » Wed, 04 Jul 2007 00:37:02 GMT
Two things
1) you have to put powershell in front of the PS script name
powershell c:\pathtoscript\SingFile.ps1
2) you dont need trailing % on %1%
Re: Call powershell script via Batch-File
by kr1999 » Wed, 04 Jul 2007 00:50:01 GMT
Hello Brandon,
thanks for your help. It works as I expected.
Reiner