Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to call powershell in python

Shulou Source: shulou.com Published: 2022-06-01 18:50:59 10月13日 Update

Today, I will talk to you about how to call powershell in python. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

* used to call the IPC API of the lookup artifact everything:

#-*-coding: utf-8-*-import osimport timeimport tracebackimport subprocessdef run_cmd (cmd): print 'CMD:%s'% cmd args=cmd p=subprocess.Popen (args Stdout=subprocess.PIPE) dt=p.stdout.read () return dtsearch_name = 'jiangkun'cmd = "C:\ Users\ jiang-kun\ Downloads\ es\ es" real_cmd = cmd+'-I' + search_nameline_list = run_cmd (real_cmd) .split ('n') print len (line_list) lenth = len (line_list) for i in range (lenth): print "% s:% s"% (I, line_ list [I]) print line_list [1]

The everything process must exist in order to use it, but it's pretty good, and you can extend the functionality yourself if necessary. Of course, you still need to use everything's fast index.

After reading the above, do you have any further understanding of how to call powershell in python? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Content yes function interface more knowledge artifact program article index industry information information channel or process channel utf-8 enter one support related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Huawei vpn MySQL Shulou Tech Info