Determine file extension before running power shell script

Determine file extension before running power shell script

Anonymous
Not applicable
406 Views
1 Reply
Message 1 of 2

Determine file extension before running power shell script

Anonymous
Not applicable

I have created a power shell script but I need to check the selected file extension and only allow it to run on IPT or IAM files.  How can I get the extension and exit the script if it is the wrong type?

 

Thanks for any assistance.

 

Mike

0 Likes
407 Views
1 Reply
Reply (1)
Message 2 of 2

wangdu
Collaborator
Collaborator

Hi Mike,

 

Is it DataStandard that you are asking about? If it is, then in the powershell you can use one of the system variables called _FileExt in the $Prop[] array. 

 

if ($Prop["_FileExt"].Value -eq "IAM" -or $Prop["_FileExt"].Value -eq "IPT" )
{
    #your code here
}
else
{
    #exit script or messagebox etc.
}