I’m writing a Powershell script to call a file convert function(to execute ANYTRAN file). I was told to put param() in a try-catch by my boss but that seems to cause an error. Then how can I catch the error from param()? I think it’s possible to use if statement in a parent shell. Please give me some advice.
Below is the code.
$ErrorActionPreference = "Stop"
try{
#-----------------------------------------------------------
# 初期処理
#-----------------------------------------------------------
#---# 環境変数定義(define common env)
#---& ".\commonEnv.ps1"
# 共通関数インクルード(include common func)
. (Resolve-Path ".\commonFunc.ps1").path
# 引数取得(get parameter)
Param(
$inFile
,$outFile
,$flgZeroByte
)