简体   繁体   中英

How to convert Powershell to C#

Is possible to convert PowerShell code.PS1 to C# code?

I'v been looking to it on google but I always find the contrary.

Reflector has the AddIn to convert DLL to PS Code , so I think it's possible..

You can try this Visual studio code extension : PowerShell Pro Tools for VS Code https://ironmansoftware.com/powershell-pro-tools-for-visual-studio-code/

在此处输入图片说明

Convert between C# and PowerShell code to easily take snippets of either language and convert it to the other. Quickly create P\\Invoke functions in PowerShell from C# snippets found on sites like Pinvoke.net.

This open source tool can do it, but the output it generates currently is not great due to the fact that PowerShell is a fairly lax language and C# is quite strict. Powershell also has a lot of commandlet wrapper functions which makes it hard to even make a tool that can really automate this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM