Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Select-FolderDialog
- {
- param([string]$Description="Select Folder to place results in",[string]$RootFolder="Desktop")
- [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |
- Out-Null
- $objForm = New-Object System.Windows.Forms.FolderBrowserDialog
- $objForm.Rootfolder = $RootFolder
- $objForm.Description = $Description
- $Show = $objForm.ShowDialog()
- If ($Show -eq "OK")
- {
- Return $objForm.SelectedPath
- }
- Else
- {
- Write-Error "Operation cancelled by user."
- }
- }
- Function Get-FileName($initialDirectory)
- {
- [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
- $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
- $OpenFileDialog.initialDirectory = $initialDirectory
- $OpenFileDialog.FileName = "Select Input File"
- $OpenFileDialog.filter = "CSV (*.csv)| *.csv"
- $OpenFileDialog.ShowDialog() | Out-Null
- }
- $inputfile = Get-FileName "C:\temp"
- $inputdata = get-content $inputfile
- $folder = Select-FolderDialog
Advertisement
Add Comment
Please, Sign In to add comment