powershell - Find a particular file name existence and execute batch command -


i looking ps script search particular file name , check existence. if file exists should execute batch command.

$version = "1.1.0" $packagename = "example.dto.$version" get-childitem "d:\test" | where-object { $_.name -match "$packagename.nupkg" } 

and batch command

c:\nugetrestore\nuget.exe push "d:\test\$packagename.nupkg" saranuget -source "http://123.456.78.90/myget" -timeout 120 

i unable integrate both this.

this covers test matches multiple files:

$version = "1.1.0" $packagename = "example.dto.$version" $filecheck = get-childitem "d:\test" | where-object { $_.name -match "$packagename.nupkg" }  $filecheck | foreach-object {     c:\nugetrestore\nuget.exe push "$($_.fullname)" saranuget -source "http://123.456.78.90/myget" -timeout 120 } 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -