none
Reading a Source File with Multiple Values per Line RRS feed

  • Question

  • So I'm aware of how to load a file with one item per line into a script using a foreach loop to process each line.

    Is it possible to apply a similar process to a row containing 2 or more values?

    Sample data might be :

    computer1,task1,task2,task3
    computer2,task1,task2,task3
    ...

    I'd like to read each line and process an schtasks command :

    schtasks /change /s $computername /tn $taskname /enable
    schtasks /change /s $computername /tn $taskname /enable
    schtasks /change /s $computername /tn $taskname /enable

    Where I treat the first value as the computername, and the following as task names.

    I know this is vague... apologies.  It's conceptware in my head at the moment. Any help is appreciated.

    Monday, July 2, 2018 5:32 PM

Answers

All replies