• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Generate many XML files

powershell

powershell

here is a simple little powershell script to do something close to what you want.
save it as .ps1 file and execute it or just paste the lot into a powershell console window.
it will write the files to your current directory so make sure you have permission and also make sure you have set your execution policy.
its easily changeable to add all the xml into you want

Code:
$array  = 1..100
foreach ($element in $array){
"<Tag1>Some XML</Tag1>`r`n<Tag2>More XML</Tag2>" |out-file "file_$element.xml"
}
 

Advertisers

Back
Top