How to run powershell code while in python -


i run:`

$filepath = "<input file path>"     $wd = new-object -comobject word.application $wd.visible = $true $txt = $wd.documents.open(     $filepath,     $false,     $false,     $false) $wd.documents[1].saveas("<export file path>") $wd.documents[1].close()` 

this powershell code needs run python script

is there way store string, in python, , run block in powershell if had copied , pasted powershell , pressed enter? trying:

    import os     script = """$filepath = "<input file path>"         $wd = new-object -comobject word.application     $wd.visible = $true     $txt = $wd.documents.open(         $filepath,         $false,         $false,         $false)     $wd.documents[1].saveas("<export file path>")     $wd.documents[1].close()"""     os.system(script)` 

i'm receiving: '$filepath' not recognized internal or external command, operable program or batch file.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -