Hi
Using Jenkins to execute some scripts in a continuous integration task.
I have a job who copies some files to a folder, the name of the folder is dynamically created. I wish to get the name of the folder.. back from my script.
The script is executed using "windows batch command", i.e.
set scriptpath=%SCRIPT_HOME%\stage.ps1
powershell.exe "& {%scriptpath% -SOURCEFOLDERNAME %SourceFolderName% -SOURCEPATH %SourcePath% -TARGETHOST1 %TargetHost1% -TARGETHOST2 %TargetHost2%; exit $lastexitcode}"
the ps script terminates using return $stagingFolderName
Have tried to set the dynamic "FolderName" as a Env variable but it's not accessible after the ps1 is done..
#[Environment]::SetEnvironmentVariable("stagingFolderName", $stagingFolderName, "User")
#[Environment]::SetEnvironmentVariable("stagingFolderName", $stagingFolderName, "Process")
#[Environment]::SetEnvironmentVariable("stagingFolderName", $stagingFolderName, "Machine")
#$env:stagingFolderName = $stagingFolderName
Im unable to find a correct syntax or way to get the folderName..
feks. Pseudo: set myVar = powershell.exe "& {%scriptpath% -SOURCEFOLDERNAME %SourceFolderName% -SOURCEPATH %SourcePath% -TARGETHOST1 %TargetHost1% -TARGETHOST2 %TargetHost2%; exit $lastexitcode}" --> Won't execute..
(Not using the powershell plugin for the missing error return)