Skip to content

Instantly share code, notes, and snippets.

@dstreefkerk
Created November 8, 2019 06:19
Show Gist options
  • Save dstreefkerk/be93ec900abd7bc2947d97a749e9fa27 to your computer and use it in GitHub Desktop.
Save dstreefkerk/be93ec900abd7bc2947d97a749e9fa27 to your computer and use it in GitHub Desktop.
Batch file that enables a CSV to be dragged/dropped and then opened in a PowerShell GridView. Requires the PowerShell ISE to be instaled.
@echo off
IF "%~1"=="" GOTO NOFILE
set CSVPATH=%~1
ECHO Loading CSV %CSVPATH%
powershell.exe -NoProfile -NoExit -NoLogo -Command "if ((Test-Path $env:CSVPATH -PathType Leaf) -and ($env:CSVPATH -like '*.csv')) {Import-Csv -Path $env:CSVPATH | Out-GridView -Wait -Title $env:CSVPATH};exit"
GOTO END
:NOFILE
ECHO No file specified
:END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment