Skip to content

Instantly share code, notes, and snippets.

@buaziz
Created April 10, 2020 19:20
Show Gist options
  • Select an option

  • Save buaziz/562d1b0c1486215d27ab8f0d63ee5ec4 to your computer and use it in GitHub Desktop.

Select an option

Save buaziz/562d1b0c1486215d27ab8f0d63ee5ec4 to your computer and use it in GitHub Desktop.
PowerShell DevOps Task - Get file name without Extension and set Task Variable
$input_path = "C:\Folder-to-Search\"
foreach($file in Get-ChildItem -Path $input_path -Recurse -Include *.cs)
{
Write-Output "fileName : $($file.BaseName)"
Write-Host "##vso[task.setvariable variable=DevOpsVariableToSet;]$($file.BaseName)"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment