2016-04-04 13 views
0

this script .csvファイルをループして1つのExcelワークシートに結合しています。私は、次のようで、この1呼び出すために2番目のスクリプトを作成しました:「X」という用語はコマンドレットの名前として認識されません

echo "Combining .csv files into Excel workbook" 
C:\PowerShell\ConvertCSVtoExcel.ps1 
Get-ChildItem *.csv | ConvertCSV-ToExcel -output ePortalMontlyReport.xlsx 
echo " " 

をしかし、私は、スクリプトを実行しようとすると、私は次のエラーを取得しています:

ConvertCSV-ToExcel : The term 'ConvertCSV-ToExcel' 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 C:\PowerShell\Merge.ps1:3 char:23 
+ Get-ChildItem *.csv | ConvertCSV-ToExcel -output ePortalMontlyReport. ... 
+      ~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : ObjectNotFound: (ConvertCSV-ToExcel:String) [], CommandNotFoundException 
    + FullyQualifiedErrorId : CommandNotFoundException

解決する方法上の任意の提案をこの?

答えて

4

セッションにインポートされた関数を取得するには、.ps1ファイルをドットソースする必要があります。

+0

ドットソース演算子のドキュメントは、「Get-Help about_Operators」にあります。そこにはたくさんの場所があるわけではありませんが、それがリストされています。 –

+0

https://technet.microsoft.com/en-us/library/hh847841.aspx(about_Scripts)とhttp://ss64.com/ps/source.htmlも役に立ちます。^ _^ – sodawillow

+0

ありがとうございましたこの特定のエラーを過ぎて次のエラーに進みますが、少なくとも私は前進することができました。 – MISNole