# vgmdb-urls

> **Status:** Active
> **Category:** URL Management
> **Language:** Batch (CMD)
> **Script file:** `URL.bat`

## Purpose

Reads a pipe-delimited list of VGMdb URLs and subfolder paths from a plain-text file (`URLs.txt`) and creates a corresponding `.url` Windows internet shortcut file in each specified subfolder under a root directory. Used to bulk-create organised `.url` shortcut structures from a prepared URL list.

## Requirements

### Dependencies

Windows Command Prompt (`cmd.exe`) — no additional software required.

## Input

| Item | Description | Example |
|------|-------------|---------|
| `URLs.txt` | Pipe-delimited file: `URL\|subfolder path` per line | See format below |
| `root_directory` | Hardcoded root path where subfolders will be created | `C:\VGMPP\02 - URLs` |

### `URLs.txt` format

Each line contains a URL and a relative subfolder path separated by `|`:

```
https://vgmdb.net/album/72090|XXX\Aqours ORIGINAL SONG CD 7 {72090}
https://vgmdb.net/album/85984|XXX\Aqours Original Song CD {85984}
https://vgmdb.net/album/12345|Artist Name\Album Title {12345}
```

The subfolder path supports nesting (backslash-separated). Any missing intermediate directories are created automatically.

## Output

| Item | Description |
|------|-------------|
| `.url` shortcut files | One `Album info.url` created per input line, inside the specified subfolder |
| Subdirectory tree | Folder hierarchy is created under `root_directory` as needed |

### Output `.url` file format

```ini
[InternetShortcut]
URL=https://vgmdb.net/album/72090
```

All shortcuts are named `Album info.url` regardless of the album title.

## Usage

```batch
REM Run from the folder containing URL.bat and URLs.txt
URL.bat
```

Or double-click `URL.bat` in Windows Explorer.

## Examples

Given this `URLs.txt`:

```
https://vgmdb.net/album/72090|XXX\Aqours ORIGINAL SONG CD 7 {72090}
https://vgmdb.net/album/85984|XXX\Aqours Original Song CD {85984}
```

After running `URL.bat`, the result under `C:\VGMPP\02 - URLs` is:

```
C:\VGMPP\02 - URLs\
  XXX\
    Aqours ORIGINAL SONG CD 7 {72090}\
      Album info.url   (contains URL=https://vgmdb.net/album/72090)
    Aqours Original Song CD {85984}\
      Album info.url   (contains URL=https://vgmdb.net/album/85984)
```

## Notes

- **Hardcoded paths:** Both `input_file` (`URLs.txt`) and `root_directory` (`C:\VGMPP\02 - URLs`) are set inside the batch file. Edit these variables before running in a different environment.
- The output shortcut filename is also hardcoded as `Album info.url` (`url_filename` variable). Change this if a different name is needed.
- The script uses `echo ... >> file` to write the `.url` content, which appends a trailing space after `URL=` on some Windows configurations. If this causes issues with URL parsers, post-process with [url-cleaner-v4](url-cleaner-v4.md) or [vgmdb-urlcleaner](vgmdb-urlcleaner.md).
- The batch file sets code page 65001 (`chcp 65001`) at startup to support UTF-8 characters in folder names.
- If a subfolder already exists, `mkdir` is skipped silently. If a `Album info.url` file already exists in that folder, it is **overwritten** without warning.
- The `URLs.txt` included in the repository contains sample VGMdb entries with the subfolder prefix `XXX\` — this prefix appears to be a staging placeholder. Adjust subfolder paths in your own `URLs.txt` as needed.

## Related Scripts

- [vgmdb-url2list](vgmdb-url2list.md) — Reverse operation: reads `.url` files from folders and exports them to a CSV
- [vgmdb-urlcleaner](vgmdb-urlcleaner.md) — Clean up `.url` files created by this script if they contain extra metadata
- [url-cleaner-v4](url-cleaner-v4.md) — Python-based URL file cleaner for post-processing the output
