Skip to content

using statement must appear before any other statements in a script #4

@ufo-government

Description

@ufo-government

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  

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions