Run powershell from Excel VBA
Budget: $14 – $30 NZD
bit(0) = "C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe"
bit(1) = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
file = "D:\10 Pwsh\CopyFile.ps1"
cmmd = bit(0) & " -noexit -file """ & file & """"
var = Shell(cmmd, vbMaximizedFocus)
it looks like this:
var = Shell("powershell.exe -noexit -file ""D:\10 Pwsh\CopyFile.ps1""", vbMaximizedFocus)
and fails.
bit(1) = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
file = "D:\10 Pwsh\CopyFile.ps1"
cmmd = bit(0) & " -noexit -file """ & file & """"
var = Shell(cmmd, vbMaximizedFocus)
it looks like this:
var = Shell("powershell.exe -noexit -file ""D:\10 Pwsh\CopyFile.ps1""", vbMaximizedFocus)
and fails.