import subprocess
command = r"[System.Windows.Forms.Clipboard]::SetFileDropList('E:\xampp\htdocs\tadiya\webpack.mix.js')"
result = subprocess.Popen(
["powershell.exe", command], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = result.communicate()
print(stdout)
print(stderr)
output
b''
b"Unable to find type [System.Windows.Forms.Clipboard].\r\nAt line:1 char:1\r\n+ [System.Windows.Forms.Clipboard]::SetFileDropList('E:\\xampp\\htdocs\\ta ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : InvalidOperation: (System.Windows.Forms.Clipboard:TypeName) [], RuntimeException\r\n + FullyQualifiedErrorId : TypeNotFound\r\n \r\n"
script is running correctly.But while using on python could'nt see any error did'nt work .what i wrong with it?
Expected Result:
script is just copy file to clipboard
nb: I could execute basic powershell commands like dir, other get-process,etc in this python code.