많은 것들을 가진 배치 파일이 있습니다. 나는 사용자를위한 정보가있는 Alert Window가 하나있다.cmd/batch에서 PowerShell Net MessageBox를 실행하는 방법
Windows Pro에서는 메시지 명령을 사용하고 있습니다. 정상적으로 작동합니다. 윈도우 홈에
아무 메시지도 없다, 그래서 내가 대신 PowerShell을 사용하는 아이디어를 가지고 : PowerShell에서 잘 작동
[System.Windows.Forms.MessageBox]::Show("my text")
.
- 그러나, 내가 배치에서 사용하거나 cmd를 직접 실행하려고 할 때, 난 단지 텍스트를 얻을 :
C:\Windows\System32>powershell {[System.Windows.Forms.MessageBox]::Show("\""my text"\"")}
[System.Windows.Forms.MessageBox]::Show("my text")
아니면 내가 오류를 얻을 :
C:\Windows\System32>powershell -command [System.Windows.Forms.MessageBox]::Show("my text")
At line:1 char:41
+ [System.Windows.Forms.MessageBox]::Show(my text)
+ ~
Missing ')' in method call.
At line:1 char:41
+ [System.Windows.Forms.MessageBox]::Show(my text)
+ ~~
Unexpected token 'my' in expression or statement.
At line:1 char:48
+ [System.Windows.Forms.MessageBox]::Show(my text)
+ ~
Unexpected token ')' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingEndParenthesisInMethodCall
또는
을 C:\Windows\System32>powershell -command "& {[System.Windows.Forms.MessageBox]::Show('my text')}"
Unable to find type [System.Windows.Forms.MessageBox].
At line:1 char:4
+ & {[System.Windows.Forms.MessageBox]::Show('my text')}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Windows.Forms.MessageBox:TypeName) [],
RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
작동하려면 어떻게해야합니까?
당신은 당신이 그것을 호출하기 전에 유형을로드해야