Is there a way to run powershell commands through C code? For example, Im trying to download image from url, but without success. Word of advice?
Using Powershell in C code
Why not use a C http library
install gentoo and use curl
would you be so kind and provide some links with more info? I spent last two days browsing stack overflow to find optimal way to download data from url but most of that sh*t is solved in object-oriented languages
Just use wget, wintoddler.
Just use system("powershell 'download...' ")
also most people closed topics with wget and curl but Im looking for way, that works on Windows
Install a real OS. Windows is for retards.
You can use system("powershell -Command 'Invoke-WebRequest ...'"), I guess.
Or start up PowerShell with CreateProcess() and figure out how to give it commands via stdin.
Windows 10 includes curl, now that you mention it, so you can just do system("curl.exe ...").
>Im looking for way, that works on Windows
install wget or curl on windows?
system("powershell [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12");
system("powershell Invoke-Webrequest -Uri "is2.Jow Forums.org/g/1562086287919.png" -Outfile d:/hobo/pic.jpg");
I was trying something like this but second command has wrong syntax and first command just loops terminal.
Why not just write a powershell script if you’re gonna use powershell? If you want to use C just use libcurl, it’s available for windows, but I can’t imagine what you could be doing that requires both C and “downloading image from url” at your obviously low skill level (no offense)
Also, sorry if this looks trivial to you guys, but I´m unexperienced, wouldn´t even consider myself junior programmer
Install Linux and use Perl.
Jesus dude you can’t have quotes inside of quotes, escape them
thanks
curl.haxx.se
If you must use powershell, just install curl binary, but I would download libcurl for windows and use that if you’re trying to learn C
One thing that you are going to realize is incredibly important is that the compiler has pretty concise error messages. It’s not just a “syntax error,” it will tell you exactly where and give you a pretty good clue as to what you did wrong
See
yeah, I would rather not trigger you guys any further with questions basic for you
It's not about having basic questions it's about asking questions that would have been answered were you to google it for 5 seconds.
How do you expect PowerShell to remember your setting - which is pointless, by the way, at least on my Windows 10 machine - across invocations?
yes, I did not realise that. I was pretty tired atm
Alright, thanks for answers I think I have enough to figure it out now