$ModDirFormat = $args[0] Set-Location -Path ".\dayz\1042420" $workshopDir = ".\steamapps\workshop\content\221100" if (Test-Path $workshopDir) { Write-Output "Linking mods" Get-ChildItem -Path $workshopDir -Directory | ForEach-Object { $modDir = Join-Path -Path $workshopDir -ChildPath $_.Name $modName = $null # Extract modName from meta.cpp $metaCppPath = Join-Path -Path $modDir -ChildPath "meta.cpp" if (Test-Path $metaCppPath) { $metaMatch = Select-String -Path $metaCppPath -Pattern '^\s*name\s*=\s*"(.*?)"' -AllMatches if ($metaMatch.Matches.Count -gt 0) { $modName = $metaMatch.Matches[0].Groups[1].Value } } if (-not $modName) { # Fallback: Try mod.cpp if meta.cpp does not contain a name $modCppPath = Join-Path -Path $modDir -ChildPath "mod.cpp" if (Test-Path $modCppPath) { $modMatch = Select-String -Path $modCppPath -Pattern '^\s*name\s*=\s*"(.*?)"' -AllMatches if ($modMatch.Matches.Count -gt 0) { $modName = $modMatch.Matches[0].Groups[1].Value } } if (-not $modName) { # Final fallback: Try fetching name from Steam workshop webpage if no name found $modID = $_.Name $steamPage = "https://steamcommunity.com/workshop/filedetails/?id=$modID" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $modName = (Invoke-WebRequest -UseBasicParsing -Uri $steamPage).Content | Select-String -Pattern '