So I have a subroutine function that opens a folder dialog I can output the folder path location to a txt file just fine. But Can't seem to store the location in the variable.
@echo off
setlocal
Call :OutputSelect
echo %location%
pause
endlocal
exit
:OutputSelect
setlocal enabledelayedexpansion
set "fchooser=%temp%\fchooser.exe"
if exist "!fchooser!" del "!fchooser!"
>"%temp%\c.cs" echo using System;using System.Windows.Forms;
>>"%temp%\c.cs" echo class dummy{[STAThread]
>>"%temp%\c.cs" echo public static void Main^(^){
>>"%temp%\c.cs" echo FolderBrowserDialog f=new FolderBrowserDialog^(^);
>>"%temp%\c.cs" echo f.SelectedPath=System.Environment.CurrentDirectory;
>>"%temp%\c.cs" echo f.Description="Select Output Folder";
>>"%temp%\c.cs" echo f.ShowNewFolderButton=true;
>>"%temp%\c.cs" echo if^(f.ShowDialog^(^)==DialogResult.OK^){Console.Write^(f.SelectedPath^);}}}
for /f "delims=" %%I in ('dir /b /s "%windir%\microsoft.net\*csc.exe"') do (
if not exist "!fchooser!" "%%I" /nologo /out:"!fchooser!" "%temp%\c.cs" 2>NUL
)
del "%temp%\c.cs"
setlocal disabledelayedexpansion
for /f "delims=" %%I in ('%fchooser%') do set location=%%I\
goto:eof