Skip to content

Instantly share code, notes, and snippets.

@Malix-off
Last active May 27, 2022 17:34
Show Gist options
  • Save Malix-off/fa79bfafb54ac88c82f937472c5e36df to your computer and use it in GitHub Desktop.
Save Malix-off/fa79bfafb54ac88c82f937472c5e36df to your computer and use it in GitHub Desktop.
Windows File Browser - COM
setlocal
for /f "delims=" %%I in ('powershell -noprofile "iex (${%~f0} | out-string)"') do (
echo You chose %%~I
)
goto :EOF
: end Batch portion / begin PowerShell hybrid chimera #>
Add-Type -AssemblyName System.Windows.Forms
$f = new-object Windows.Forms.OpenFileDialog
$f.InitialDirectory = pwd
$f.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
$f.ShowHelp = $true
$f.Multiselect = $true
[void]$f.ShowDialog()
if ($f.Multiselect) { $f.FileNames } else { $f.FileName }
@Malix-off
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment