0

I was wondering whether there is someone out there that could help me modifying my current piece of code to incorporate a popup dialogue box that asks users to specify where they have put their %name%.dsd file. I would also like for it to be stored in a variable like %location% so I would be able to replace the current method of using %cd%. The code is as follows:

@echo off
echo.
echo Hello!
echo Got file?
color f9
set /p="What did you name your file?:"<nul
set /p name=
cd %localhost%
echo -publish> %name%%.scr
echo %cd%\%name%%.dsd>>  %name%%.scr
@echo off
echo Set oWS = WScript.CreateObject("WScript.Shell") > CreateShortcut.vbs
echo sLinkFile = "%cd%\%name%%.lnk" >> CreateShortcut.vbs
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> CreateShortcut.vbs
echo oLink.TargetPath = "C:\Program Files\Autodesk\AutoCAD 2017\accoreconsole.exe" >> CreateShortcut.vbs
echo oLink.arguments = "/s %cd%\%name%%.scr" >> CreateShortcut.vbs
echo oLink.Save >> CreateShortcut.vbs
cscript CreateShortcut.vbs
del Createshortcut.vbs
cls
echo .
echo .
echo .
echo .
echo .
echo .
echo .
echo .
echo . Done, bye!
echo .
pause 
Dnll
  • 1
  • check this - https://stackoverflow.com/questions/15885132/file-folder-chooser-dialog-from-a-windows-batch-script , and this https://github.com/npocmaka/batch.scripts/blob/master/hybrids/jscript/shortcutJS.bat . Later I'll try to create a whole script .... – npocmaka Nov 09 '18 at 14:27

1 Answers1

1

You can call out to Powershell real easy from a batch file to create a dialogue box to have the user pick a folder.

@echo off
set "psCommand="(new-object -COM 'Shell.Application').BrowseForFolder(0,'Please choose your SOURCE folder.',0x270,0).self.path""
for /f "usebackq delims=" %%I in (`powershell %psCommand%`) do set "location=%%I
echo %location%
pause
exit
Squashman
  • 13,649
  • 5
  • 27
  • 36