Windows RT에서 응용 프로그램을 개발 중입니다. Windows RT (C#)에서 PowerShell 또는 CMD 명령을 실행하거나 호출해야한다는 요구 사항이 있습니다. 미리 감사드립니다.Powershell 명령 (Windows RT)
답변
Windows RT에서 PowerShell .NET 엔진에 대해 직접 프로그래밍 할 수는 없지만 소켓을 통해 데스크톱에 액세스 할 수 있습니다. 그러나 이것은 데스크탑 소켓 리스너가 설치되어 있는지 확인하는 것입니다 (&). 그러나 실행중인 &에서 명령을 실행하여 cmd.exe (또는 EXE 또는 in-proc 엔진을 통해 powershell)를 호출 할 수 있습니다. Win32에서 무엇이 좋을까요? &에 연결할 수있는 엔진 부분은 PowerShell 원격 끝점을 사용합니다. 궁극적으로 궁극적으로 마이크로 소프트 외부의 누군가가 할 수있는 소켓 일 뿐이며 WS-MAN 프로토콜을 통해 어떻게 동작하는지 파악해야합니다. 소켓을 통해 전송되는 간단한 문자열이 더 쉽다고 생각합니다. 'powershell -command "& { Get-Process }"'
또는 'cmd /c dir c:\'
.
WinRT의 코드 :
바탕 화면 측면에서private async void _button_OnClick(object sender, RoutedEventArgs e)
{
string content;
try
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("user-agent",
"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)");
var response = await client.GetAsync("http://localhost:54649/");
if (response.StatusCode == HttpStatusCode.OK)
{
content = await response.Content.ReadAsStringAsync();
}
else
{
content = response.StatusCode.ToString();
}
}
catch (Exception ex)
{
content = ex.Message;
}
await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,() =>
{
_textBlock.Text = content;
});
}
, 여기에 뇌사 MVC 컨트롤러의 코드 조각입니다 :
:-)여기 개념의 증거로 코드의 일부 조각을이다
public class HomeController : Controller
{
//
// GET: /Home/
public string Index()
{
return "Hello World. The time is " + DateTime.Now;
}
}
친애하는 Kieth에게 답장을 보내 주셔서 감사합니다. 나는 승리 rt하지만 헛된에 대한 데스크톱 소켓을 만들 그물을 검색했다. Win rt 용 데스크탑 소켓을 만드십시오. – sathia
- 1. 새 개체에 대한 Windows RT Powershell (PermissionDenied)
- 2. PowerShell - 원격 Windows 명령 실행
- 3. Windows powershell : 명령 프롬프트 변경
- 4. Windows RT vs Windows 8
- 5. ScheduleActionService for Windows RT
- 6. Windows RT 및 C#
- 7. Windows RT .NET 호환성
- 8. Windows Powershell 명령 줄에 해당하는 dd
- 9. 파일의 텍스트를 변경하는 Windows PowerShell 명령
- 10. Powershell 명령 - 명령 프롬프트에서
- 11. PowerShell 명령
- 12. 거기에 호환되는 ORM Windows RT
- 13. Windows 8의 USB CDC RT
- 14. Windows RT App에서 이미지가 깜박임
- 15. Windows RT IE10 대 Windows 8 IE10
- 16. PHP에서 Powershell 명령 실행
- 17. Powershell Subst 명령
- 18. Foreach 루프에서 Powershell 명령 결합
- 19. 실행 PowerShell 명령
- 20. 명령 줄에서 Powershell 실행
- 21. Powershell 원격 명령
- 22. Powershell 명령 줄 throw
- 23. powershell 명령 실행 진행?
- 24. Powershell 명령 : rm -rf
- 25. Powershell & Plink - 명령 형식
- 26. C#의 PowerShell 명령
- 27. PowerShell 명령 메타 데이터
- 28. Powershell : html 서식 내에서 powershell 명령 사용
- 29. windows rt app에 사용자 설정을 저장하는 방법
- 30. Windows RT : 스냅 모드 ListView를 GridView로 변경
powershell (테스트되지 않음) 용으로 일반 C# API를 사용할 수 없습니까? 전의. http://www.codeproject.com/Articles/18229/How-to-run-PowerShell-scripts-from-C –
Graimer 답장을 보내 주셔서 감사합니다. 이 쿼리를 게시하기 전에 codeproject에서 기사를 확인했지만 이름 공간 system.management.automation은 Win RT에서 제한됩니다. – sathia