PowerShell-Misc icon indicating copy to clipboard operation
PowerShell-Misc copied to clipboard

using statement must appear before any other statements in a script

Open ufo-government opened this issue 2 years ago • 0 comments

Thanks for your interesting scripts! I have error:

PS C:\Users\ufo_g\Desktop\ОбработкаИзображенийPowerShell> .\Get-Win10OcrTextFromImage.ps1 "C:\Users\ufo_g\Desktop\ОбработкаИзображенийPowerShell\ForPowerShellWMIedit.bmp"
At C:\Users\ufo_g\Desktop\ОбработкаИзображенийPowerShell\Get-Win10OcrTextFromImage.ps1:2 char:1
+ using namespace Windows.Graphics.Imaging
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A 'using' statement must appear before any other statements in a script.
At C:\Users\ufo_g\Desktop\ОбработкаИзображенийPowerShell\Get-Win10OcrTextFromImage.ps1:17 char:1
+ [CmdletBinding()]
+ ~~~~~~~~~~~~~~~~~
Unexpected attribute 'CmdletBinding'.
At C:\Users\ufo_g\Desktop\ОбработкаИзображенийPowerShell\Get-Win10OcrTextFromImage.ps1:18 char:1
+ Param
+ ~~~~~
Unexpected token 'Param' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : UsingMustBeAtStartOfScript
 

PS C:\Users\ufo_g\Desktop\ОбработкаИзображенийPowerShell> $PSVersionTable

Name                           Value                                                                                                                  
----                           -----                                                                                                                  
PSVersion                      5.1.19041.3031                                                                                                         
PSEdition                      Desktop                                                                                                                
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                
BuildVersion                   10.0.19041.3031                                                                                                        
CLRVersion                     4.0.30319.42000                                                                                                        
WSManStackVersion              3.0                                                                                                                    
PSRemotingProtocolVersion      2.3                                                                                                                    
SerializationVersion           1.1.0.1  

ufo-government avatar Sep 05 '23 15:09 ufo-government