I am trying to make a path directory generic for all users using batch file. The code generates a popup and it asks the user to input the folder. The directory is echoed on the terminal. I am trying to pass the this output directory as an argument in another function 'folder' so that the application starts running. But I am not able to pass the argument.
@echo off
Title Browse4Folder
Color 0A
Call :Browse4Folder "Choose source folder to scan" "c:\scripts"
echo You have chosen this location "%Location%"
pause & exit
::***************************************************************************
:Browse4Folder
set Location=
set vbs="%temp%\_.vbs"
set cmd="%temp%\_.cmd"
for %%f in (%vbs% %cmd%) do if exist %%f del %%f
for %%g in ("vbs cmd") do if defined %%g set %%g=
(
echo set shell=WScript.CreateObject("Shell.Application"^)
echo set f=shell.BrowseForFolder(0,"%~1",0,"%~2"^)
echo if typename(f^)="Nothing" Then
echo wscript.echo "set Location=Dialog Cancelled"
echo WScript.Quit(1^)
echo end if
echo set fs=f.Items(^):set fi=fs.Item(^)
echo p=fi.Path:wscript.echo "set Location=" ^& p
)>%vbs%
cscript //nologo %vbs% > %cmd%
for /f "delims=" %%a in (%cmd%) do %%a
for %%f in (%vbs% %cmd%) do if exist %%f del /f /q %%f
for %%g in ("vbs cmd") do if defined %%g set %%g=
PAUSE
Call :Folder Location
:Folder
Set T32_PATH=%Location%
ECHO T32_PATH=%Location%
cd ..\Appl
START %Location%\t32mtc.exe -c ..\cm3550a_vecm\vlab_mcd.t32 -s ..\cm3550a_vecm\vlab_mcd_config.cmm
ECHO T32_PATH=%Location%
PAUSE
I have to pass the argument to line START %Location%\t32mtc.exe -c ..\cm3550a_vecm\vlab_mcd.t32 -s ..\cm3550a_vecm\vlab_mcd_config.cmm How shall I do it.