I have written a sample program that will write Hello World
and created NSIS
file and executed which works fine for me
My .nsi
script goes as follows
- !include "x64.nsh"
-
- Name "nsExec Test"
- OutFile "nsExecTest.exe"
- #ShowInstDetails show
-
- Section "Output to variable"
- nsExec::ExecToStack 'powershell.exe "& "Import-Module C:\PowerShell\Hello.ps1"'
- Pop $0
- Pop $1
- DetailPrint '"ImportModules" printed: $1'
- SectionEnd
Which is printing the write host as per written when I executed it. My code in .ps1
file
- # Filename: Hello.psm1
- Write-Host
- Write-Host 'Hello World!'
- Write-Host "Good-bye World! `n"
- # end of script
Now I am trying to achieve the same with parameters, can some one help me
- # Filename: TestParameter.ps1
- function TestParam([string] $TestParam)
- {
- Write-Host
- Write-Host '$TestParam'
- Write-Host "Good-bye $TestParam! `n"
- }
- # end of script