Python Forum
run command on system with multi qoutes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
run command on system with multi qoutes
#1
hello all ...
im trying yo execute this command on my system via powershell :

Quote:powershell -command "$cli = New-Object System.Net.WebClient;$cli.Headers['User-Agent'] = 'myUserAgentString';$cli.DownloadFile('https://drive.google.com/uc?export=download&id=19LJ6Otr9p_stY5MLeEfRnA-jD8xXvK3m', '%appdata%\putty.exe')"

i keeep getting this error SyntaxError: invalid syntax ... the problem from qoutes !!
can u guide me how to execute it and how to deal with multi qoutes ?
my code :

def downloadfile():
    down = subprocess.call('powershell -command "$cli = New-Object System.Net.WebClient;$cli.Headers['User-Agent'] = 'myUserAgentString';$cli.DownloadFile('https://drive.google.com/uc?export=download&id=19LJ6Otr9p_stY5MLeEfRnA-jD8xXvK3m', '%appdata%\putty.exe')"')
    time.sleep(20)
    


downloadfile()
Reply


Messages In This Thread
run command on system with multi qoutes - by evilcode1 - Aug-30-2018, 09:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Os.system("shutdown"); command not found cosmin1805 4 1,754 Nov-13-2022, 02:07 PM
Last Post: cosmin1805
  Help with multi-window system garynewport 3 2,648 Mar-16-2022, 03:05 AM
Last Post: deanhystad
  how to run linux command with multi pipes by python !! evilcode1 2 6,444 Jan-25-2021, 11:19 AM
Last Post: DeaD_EyE
  Difference between os.system("clear") and os.system("cls") chmsrohit 7 16,757 Jan-11-2021, 06:30 PM
Last Post: ykumar34
Question Difference between Python's os.system and Perl's system command Agile741 13 6,964 Dec-02-2019, 04:41 PM
Last Post: Agile741
  System Command sushmita13 3 3,767 Apr-25-2017, 11:53 PM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020