Python OS.System with variables and quotes -


#!/usr/bin/python import os  readline = open('desktops.txt','r')  line in readline:        machinename = line        query = os.system(r'wmic -u corp.fakedomain.com/domainusername%password //'+machinename+ '"select * win32_useraccount localaccount = true"|grep "500|"|cut -d "\\" -f 2|cut -d "|" -f1') 

getting.....

"example: wmic -u [domain/]adminuser%password //host "select * win32_computersystem" sh: syntax error: unterminated quoted string"

if replace \\machinename variable real ip 192.168.1.100 works fine.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -