News for hackers. Stuff that matters.
Re:Microsoft’s PowerShell Core Offers Cross-Platform Automation by rb808 on Monday January 22, 2018 @01:08PM (#16206464)
Sometimes I just want to open a shell and run an exe. With powershell you need to run a command which runs the application. I gave up after that. https://stackoverflow.com/questions/1673967/how-to-run-an-ex...
Re:Microsoft’s PowerShell Core Offers Cross-Platform Automation by randomString1 on Monday January 22, 2018 @01:16PM (#16206524)
What's wrong with .\example.exe? Or .example.exe, .$exampleWithPath for PS1 files? Just examples that I see in the wild
Re:Microsoft’s PowerShell Core Offers Cross-Platform Automation by rb808 on Monday January 22, 2018 @01:21PM (#16206562)
Didn't work for me, I think you have to prepend with a & so

& notepad.exe

Which isn't complicated I agree but annoyed me.

Re:Microsoft’s PowerShell Core Offers Cross-Platform Automation by AnIdiotOnTheNet on Monday January 22, 2018 @01:26PM (#16206601)
What version of Powershell are you using?

Just typing "notepad" is enough to launch it. The problems with powershell and executables only really come in to play when argument passing, where some escaping is necessary.

Re:Microsoft’s PowerShell Core Offers Cross-Platform Automation by rb808 on Monday January 22, 2018 @01:43PM (#16206742)
3, we still have win7 at work.
Re:Microsoft’s PowerShell Core Offers Cross-Platform Automation by joeyaiello on Monday January 22, 2018 @01:55PM (#16206864)
You can download and install PowerShell Core 6 completely side-by-side with Windows PowerShell 3.0. We even have a portable ZIP you can drop down wherever: https://github.com/powershell/powershell/releases
Re:Microsoft’s PowerShell Core Offers Cross-Platform Automation by Arnavion on Monday January 22, 2018 @03:56PM (#16207830)
The only reason to use iex is if the thing you're trying to execute is not directly the name of the process. So you need & for `&'notepad'` and `&$string_variable` but not `notepad`
Re:Microsoft’s PowerShell Core Offers Cross-Platform Automation by gecko on Monday January 22, 2018 @03:26PM (#16207593)
That's not quite correct (and neither is that StackOverflow answer).

If you want to execute the EXE stored in a variable or whatnot, then yes, you need `&`, which I think is borrowed from Perl. But otherwise, the rules in PowerShell are the same as a Unix shell: if it's in the PATH, just type the command name (with or without the .exe); otherwise, use the full path.

Re:Microsoft’s PowerShell Core Offers Cross-Platform Automation by Arnavion on Monday January 22, 2018 @07:18PM (#16209555)
>That's not quite correct (and neither is that StackOverflow answer).

The SO answer isn't wrong. The EXE there has a space in the path. The answer uses a string literal for it and thus needs &. It could of course escape the spaces with ` instead; then it wouldn't need a string literal and thus not need &.