I am getting crazy to do something that shall be relatively easy... I am using the code in File / folder chooser dialog from a Windows batch script in a bat file to open the file dialog and let the user select multiple files. What I need to do next is to concatenate the result of the selection in a single string to pass as parameters to another application. I am failing to concatenate the strings...
What I have is:
<# : chooser.bat
:: launches a File... Open sort of file chooser and outputs choice(s) to the console
:: https://stackoverflow.com/a/15885133/1683264
@echo off
setlocal
set slctn=
for /f "delims=" %%I in ('powershell -noprofile "iex (${%~f0} | out-string)"') do (
echo You chose %%~I
set slctn=!slctn!|%%~I
)
REM here use %slctn% in another command
echo %slctn%
goto :EOF
: end Batch portion / begin PowerShell hybrid chimera #>
Add-Type -AssemblyName System.Windows.Forms
$f = new-object Windows.Forms.OpenFileDialog
$f.InitialDirectory = "C:\Users\Public\Documents\MCI\Sito Web"
$f.Title = "Seleft PDF files to merge"
$f.Filter = "PDF Files (*.pdf)|*.pdf|All Files (*.*)|*.*"
$f.ShowHelp = $true
$f.Multiselect = $true
[void]$f.ShowDialog()
if ($f.Multiselect) { $f.FileNames } else { $f.FileName }
And the result I get is:
C:\Users\Public\Documents\MCI\Sito Web\Insieme>MergePDFInsieme
You chose C:\Users\Public\Documents\MCI\Sito Web\Ristorante\2016-02-08\menugiornaliero.pdf
'C:\Users\Public\Documents\MCI\Sito' is not recognized as an internal or external command, operable program or batch file.
C:\Users\Public\Documents\MCI\Sito Web\Insieme>
Can somebody help?