🖥️ Batch (CMD)
Export Network Shares to CSV (Batch)
Uses wmic to export Network Shares (Win32_Share) to a timestamped CSV file.
ExportShareToCsv.bat
@echo off
:: ============================================================
:: ExportShareToCsv.bat
::
:: Exports Network Shares (Win32_Share) to a timestamped CSV file next to
:: this script.
:: ============================================================
setlocal EnableDelayedExpansion
for /f "skip=1 tokens=1-2 delims=." %%a in ('wmic os get localdatetime') do if not defined LDT set LDT=%%a
set "OUTFILE=%~dp0share_!LDT:~0,8!-!LDT:~8,6!.csv"
wmic path Win32_Share get Name,Path,Description,Type /format:csv > "%OUTFILE%"
echo Exported to "%OUTFILE%"
endlocal
pause