Python Forum
calling a variable in a for loop in windows - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: calling a variable in a for loop in windows (/thread-24900.html)



calling a variable in a for loop in windows - dwaynes - Mar-09-2020

I am new to python and I am trying to figure out how to call some windows commands inside a python script, below is the powershell script that works but I can't figure out how to convert this to python with the subprocess command any help would be appreciated.

horcmstart 100 101

$servers = @(“dc2pa90048”,”tocpaIIB-TI”,”lsys7011a-TI”,"powerlink-asys002-TI")
Foreach ($server in $servers) {
	pairdisplay -IM100 -g $server -fcx
    
	start-sleep -s 1 
    "`n"
}



RE: calling a variable in a for loop in windows - mcmxl22 - Apr-02-2020

You can use system().
installs pip-review.
system("pip install --user pip-review")

clears screen.
system("clear")

Note: The commands must be strings.