Передайте путь к файлу с помощью диалогового окна "Открыть файл" с помощью пакетного программирования
Я наткнулся на следующую программу, чтобы открыть диалоговое окно открытия файла GUI и отобразить путь к файлу на консоли.
<# : chooser.bat
@echo off
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 = "Excel File (*.xlsx)|*.xlsx"
$f.ShowHelp = $true
$f.Multiselect = $false
[void]$f.ShowDialog()
if ($f.Multiselect) { $f.FileNames } else { $f.FileName }
Также у меня есть Excel для конвертирования.CSV.
::**************** Documentation ***************
:::XLS2CSV.bat <xlsx_file> [csv_file_name] [/Y] [/S <"delim">]
:::
::: Converts Excel spreadsheet file to a comma delimited CSV file
::: If optional CSV output filename is not specified the output
::: will use the original path\filename with a .csv extension
:::
::: The default field delimiter is the comma "," character
::: Note: The CSV file may have unexpected results if cells contain commas
::: To change the separator a single character must follow the '/S' option
::: or the 'tab' character may be specified by using: /S /t
::: The pipe '|' character may be specified by using: /S /p
::: The separator may need to be quoted, ie. /S ";" to be recognized
::: as a non space character or special character at the command line
:::
::: Use /Y to force confirmation of overwright if the CSV file exists
::: Otherwise the user is prompted before the existing file is overwritten
:::
:::EXAMPLE:
:::
::: XLS2CSV "D:\XLpath\my file.xlsx" "D:\CSVfiles\my file.csv" /Y /S ";"
::: Will overwright the existing CSV file using ';' as the delimiter
:::
::: This hybyid script uses CScript:Jscript for the conversion and
::: Returns any errors encountered in the errorlevel
:::