Baranidharan
Baranidharan

Reputation: 1

read file and run files as per file sequence listed in file with powershell

Requirement is need to read the file (filelist.txt) and run the files which present in different folder in sequence as per listed in filelist.txt with powershell script.

I have file named filelist.txt.

filelist.txt contain below value

VT_value.ps1
SAB_NUM.ps1
RAME_CHANGE.ps1
GAMT_VALU.ps1

Upvotes: 0

Views: 66

Answers (1)

Mathias R. Jessen
Mathias R. Jessen

Reputation: 175085

Assuming that filelist.txt is in the current directory, and the scripts are in C:\path\to\scripts, you could use the call operator (&) like this:

Get-Content filelist.txt |ForEach-Object {
    & (Join-Path C:\path\to\scripts $_)
}

Upvotes: 1

Related Questions