2016-04-04 19 views
0

this script'u .csv dosyaları arasında dolaşacak ve bunları bir Excel çalışma sayfasında birleştirecek şekilde buldum. Sonra aşağıdaki bunu çağırmak için ikinci senaryo oluşturuldu:'X' terimi bir cmdlet'in adı olarak tanınmadı

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

Ama senaryoyu çalıştırmayı denediğinizde, aşağıdaki hatayı alıyorum:

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

nasıl çözüleceğine ilişkin herhangi önerileri bu?

cevap

4

Oturumunuza aktarılan işlevleri almak için .ps1 dosyasını nokta kaynağına eklemeniz gerekir.

. C:\PowerShell\ConvertCSVtoExcel.ps1 
+0

Nokta kaynağı operatörünün belgelerine, 'Get-Help about_Operators' bölümünde bulunabilir. Orada bir sürü yer yok, ama listelendiği yer burası. –

+0

https://technet.microsoft.com/en-us/library/hh847841.aspx (about_Scripts) ve http://ss64.com/ps/source.html de yardımcı olabilir^_^ – sodawillow

+0

Teşekkürler Bu hatayı ve bir sonrakini geçtik - ama en azından ilerleyebildim. – MISNole

İlgili konular