windows - How to refer C++ enum in Powershell script -


am new powershell scripting. can suggest simple way refer enum/constant defined in c++ header file in powershell? in advance.

there isn't direct way .net enum. either have to:

  • parse header file , find value yourself.
  • synthesize c++/cli cpp file #include of header file , exposes enum/const via .net type.

for first, can use get-content read in header file line-by-line , -match and/or select-string regular expression search. second, (the route go), need use cl.exe /clr switch generate dll can loaded add-type -path c:\clicpp.dll. once you've declared managed enum in c++/cli, uses values header file, can reference in powershell so:

[namespacename.enumname]::enumvalue