Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

merge batch code with chooser file dialog box

MANTONIOPM
Enthusiast

merge batch code with chooser file dialog box

MANTONIOPM
Enthusiast
Enthusiast

I would like to know how I could mix this code that I got from the internet to integrate it into my batch code. The code that I have obtained is used to be able to select drawing files.

CODE TO MIX:

<# : chooser.bat
:: launches a File... Open sort of file chooser and outputs choice(s) to the console

@Anonymous 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 = "Dibujo de AutoCAD (*.dwg)|*.dwg|All Files (*.*)|*.*"
$f.ShowHelp = $true
$f.Multiselect = $true
[void]$f.ShowDialog()
if ($f.Multiselect) { $f.FileNames } else { $f.FileName }

--------------------------------MI CODE------------------------------------------

set accoreexe="C:\Program Files\Autodesk\AutoCAD 2022\accoreconsole.exe"

set "source=B:\Archivos & proyectos CAD-BIM\Proyectos\Terminados\XSD\1878 CAM\Planos\09 Integracion Ambiental"

set script="%~dp0..\SCRIPTS\AUTOPUBLISH.scr"
FOR /f "delims=" %%f IN ('dir /b "%source%\*.dwg"') DO %accoreexe% /i "%source%\%%f" /s %script%
:: Comment the following line to autmatically close the console

0 Likes
Reply
137 Views
0 Replies
Replies (0)