WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Run PowerShell Command

 Keywords: Run RunWait Shellexecute PowerShell Command Cmdlet get-date get-help get-member .Net 

pwrshl_cmd =  'get-date'
tmpfile = FileCreateTemp( 'Tmp' ); Create temporary outputfile
RunWait( 'powershell', '-command ': pwrshl_cmd:' |out-file ':tmpfile )
data = FileGet( tmpfile )
Pause( pwrshl_cmd, data )
FileDelete(tmpfile) ; Delete temporary outputfile
Exit


pwrshl_cmd =  'get-help'
tmpfile = FileCreateTemp( 'Tmp' ); Create temporary outputfile
RunWait( 'powershell', '-command ': pwrshl_cmd:' |out-file ':tmpfile )
data = FileGet( tmpfile )
Pause( pwrshl_cmd, data )
FileDelete(tmpfile) ; Delete temporary outputfile
Exit


Enumerate members of an object

;Winbatch 2012A - Enumerate .NET Assembly Object via Powershell
;
;Simple demonstration to pull the Properties, Methods, Events from the .Net Windows Form object
;////////////////////////////////////////////////////////////////////////////////////////////////////////

pwrshl_cmd =  `Get-Member -InputObject [System.Windows.Forms.Form"]`
tmpfile = FileCreateTemp( 'Tmp' ); Create temporary outputfile
RunWait( 'powershell', '-command ': pwrshl_cmd:' |out-file ':tmpfile )
data = FileGet( tmpfile )
Pause( pwrshl_cmd, data )
FileDelete(tmpfile) ; Delete temporary outputfile
Exit

Article ID:   W17947
Filename:   Run PowerShell Command.txt
File Created: 2012:05:14:08:57:36
Last Updated: 2012:05:14:08:57:36