Is there a way to use a command to add a network location (not drive)


Chrysalis

Well-known member
Member
VIP
Local time
7:04 PM
Posts
18
Location
UK
OS
Windows 10
So basically when you go through the long manual process of right clicking, add network location, and then it appears as a network location (not a mapped drive).

It creates a special link in $APPDATA\Microsoft\Windows\Network Shortcuts

Mklink is close, but cant create the same type of links.

I want the proper function but done via command line, I am at the point where it feels like Microsoft have purposely designed it to be only possible via point and click, 4 hours of research and counting.
 

My Computer My Computer

At a glance

Windows 1013700k32 Gig 3200CL12Nvidia 4800 Super RTX
OS
Windows 10
Computer type
PC/Desktop
CPU
13700k
Motherboard
Asrock Steel Legend D4 Z690
Memory
32 Gig 3200CL12
Graphics Card(s)
Nvidia 4800 Super RTX
Sound Card
Creative AE9
Monitor(s) Displays
LG 27GL850
Screen Resolution
2560x1440
Hard Drives
970 EVO 1TB
SN850X 2TB
DC P4600 2TB
860 EVO 1TB
3 x 3TB WD Red
2 x 4TB WD Red
PSU
Antec HCG 750 Gold
Case
Fractal Define R4
Cooling
Noctua NH-D15S
Internet Speed
1000/1000
Browser
Firefox
Antivirus
Windows Defender
I created 7 network shortcuts to the computers in my network. I keep them in a folder.

My Network.webp

I checked for and found the folder, "C:\Users\MisterEd\AppData\Roaming\Microsoft\Windows\Network Shortcuts"

That folder is empty. Note I checked and there are no hidden files there.
 

My Computers My Computers

  • At a glance

    Windows 11 Pro 25H2 (26200.6901)AMD Ryzen 7 6800H with Radeon 680M GPU (486MB...Crucial DDR5-4800 (2400MHz) 32GB (2 x 16GB)NVIDIA RTX 3060 Laptop (6GB RAM)
    OS
    Windows 11 Pro 25H2 (26200.6901)
    Computer type
    Laptop
    Manufacturer/Model
    ASUS TUF Gaming A15 (2022)
    CPU
    AMD Ryzen 7 6800H with Radeon 680M GPU (486MB RAM)
    Memory
    Crucial DDR5-4800 (2400MHz) 32GB (2 x 16GB)
    Graphics Card(s)
    NVIDIA RTX 3060 Laptop (6GB RAM)
    Sound Card
    n/a
    Monitor(s) Displays
    15.6-inch
    Screen Resolution
    1920x1080 300Hz
    Hard Drives
    2 x Samsung 990 Evo Plus (2TB M.2 NVME SSD)
    PSU
    n/a
    Mouse
    Wireless Mouse M510
    Internet Speed
    2100Mbps/300Mbps
    Browser
    Firefox
    Antivirus
    Malwarebytes
  • At a glance

    Windows 11 Pro 25H2 (26200.8246)AMD Ryzen 7 5700X3DG.SKILL Flare X 32GB (2x16GB) DDR4ASUS ROG-STRIX-RTX3060TI-08G-V2-GAMING (RTX 3...
    Operating System
    Windows 11 Pro 25H2 (26200.8246)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom build
    CPU
    AMD Ryzen 7 5700X3D
    Motherboard
    ASUS ROG Strix B550-F Gaming WiFi II
    Memory
    G.SKILL Flare X 32GB (2x16GB) DDR4
    Graphics card(s)
    ASUS ROG-STRIX-RTX3060TI-08G-V2-GAMING (RTX 3060-Ti, 8GB RAM)
    Monitor(s) Displays
    Samsung G50D IPS 27"
    Screen Resolution
    1440p/180Hz
    Hard Drives
    SAMSUNG 990 EVO Plus (2TB] M.2 NVME SSD
    SAMSUNG 990 EVO Plus (4TB) M.2 NVME SSD
    PSU
    Corsair RM750x (750 watts)
    Case
    Cooler Master MasterCase 5
    Cooling
    Scythe Mugen 6
    Keyboard
    Logitech K520 (MK540 keyboard/mouse combo)
    Mouse
    Logitech M310 (MK540 keyboard/mouse combo)
    Internet Speed
    2100 Mbps down / 300 Mbps up
    Browser
    Firefox, Edge, Chrome
    Antivirus
    Malwarebytes (Premium)
    Other Info
    ASUS Blu-ray Burner BW-16D1HT (SATA) || Western Digital Easystore 20TB USB 3.0 external hard drive used with Acronis True Image 2025 backup software || HP OfficeJet Pro 6975 Printer/Scanner
Not exactly command line, but here's a PowerShell method. You basically create a regular Windows shortcut (.lnk) to the target location, and a desktop.ini with specific contents.

Powershell:
Set-StrictMode -Version 'latest'

# The name of the network shortcut to be added.
[string]$name = "ISOs and Junk"

# The UNC path to which the network shortcut will point.
[string]$target = "\\gumdrops\Boot Media"

# The path of the folder containing the network shortcut data.
[string]$shortcutPath = Join-Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::NetworkShortcuts)) $name

# Create the folder if it doesn't exist.
if (-not (Test-Path -Path $shortcutPath)) { New-Item -ItemType Directory -Path $shortcutPath -Force | Out-Null }

# Need to add the read-only attribute to the folder, or Windows doesn't like it.
attrib.exe +R $shortcutPath

# Create the desktop.ini file.
@"
[.ShellClassInfo]
CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}
Flags=2
"@ | Set-Content -Path (Join-Path $shortcutPath "desktop.ini") -Encoding Unicode

attrib +h +s -a -i (Join-Path $shortcutPath "desktop.ini")

# Create the shortcut (.lnk) file.
$shell = New-Object -ComObject WScript.Shell
$shortcut = $shell.CreateShortcut((Join-Path $shortcutPath "target.lnk"))
$shortcut.TargetPath = $target
$shortcut.Save()

Edit: Decorated with comments so folks can see what's what.
 

My Computer My Computer

At a glance

Windows 11 Enterprise 25H2
OS
Windows 11 Enterprise 25H2
  • Open File Explorer and locate the network share.
  • Right-click the network folder or mapped drive.
  • Select Create shortcut (or select Show more options first on Windows 11).
  • Click Yes if a prompt asks to place the shortcut on the desktop
Once the shortcut is created on the desktop, you can pin it to quick access or taskbar. You can also move the shortcut any where you want to.
 

My Computers My Computers

  • At a glance

    Windows 11 Pro 25H2 26200.9168i9-10900 10 core 20 threads32 gbnone-Intel UHD Graphics 630
    OS
    Windows 11 Pro 25H2 26200.9168
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 7080
    CPU
    i9-10900 10 core 20 threads
    Motherboard
    DELL 0J37VM
    Memory
    32 gb
    Graphics Card(s)
    none-Intel UHD Graphics 630
    Sound Card
    Integrated Realtek
    Monitor(s) Displays
    Benq 27
    Screen Resolution
    2560x1440
    Hard Drives
    2x1tb Solidigm m.2 nvme /External drives 512gb Samsung m.2 sata+2tb Kingston m2.nvme
    PSU
    500w
    Case
    MT
    Cooling
    Dell Premium
    Keyboard
    Logitech wired
    Mouse
    Logitech wireless
    Internet Speed
    so slow I'm too embarrassed to tell
    Browser
    #1 Edge #2 Firefox
    Antivirus
    Defender+MWB Premium
  • At a glance

    Windows 11 Pro 24H2 26200.9168AMD Ryzen 7 6800U32 gbintegrated
    Operating System
    Windows 11 Pro 24H2 26200.9168
    Computer type
    PC/Desktop
    Manufacturer/Model
    Beelink Mini PC SER5
    CPU
    AMD Ryzen 7 6800U
    Memory
    32 gb
    Graphics card(s)
    integrated
    Sound Card
    integrated
    Monitor(s) Displays
    Benq 27
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Crucial nvme
    Keyboard
    Logitech wired
    Mouse
    Logitech wireless
    Internet Speed
    still too embarrassed to tell
    Browser
    Firefox
    Antivirus
    Defender
  • System 3 is non compliant Dell 9020 i7-4770/24gb ram Win11 PRO 26200.9168

Latest Support Threads

Back
Top Bottom