Nepethya Rana

Nepethya Rana

  • NA
  • 335
  • 152.8k

how do i create cmdlets that invokes a function

May 1 2016 5:57 PM
I have zero knowledge of widows powershell. I have situation where i need to create parameter and function(a wrapper). Function when invoked return string and set the value to one of the parameter. I don't even know where do i write powershell script and i think there is ISE where i can write but how to build them get the bat file? 
 
My situation is something like this.
 
Command is ExportBill.exe which takes three arguements : filename, customerType and Id 
function GenerateFileName(string fName)
{
return String.Format("{0}{1}",fName.ToUpper().Substring(0, 3),DateTime.Now.ToString("yyyyMMddHHmmss"));
}

ExportBill.exe -fileName GenerateFileName() -customerType "WholeSeller -@Id query_parameters
How do i do it in Powershell?  

Answers (1)