OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

English support forum

Moderators: petermad, Stefan2, Hacker

User avatar
beb
Power Member
Power Member
Posts: 762
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *beb »

fc62 wrote: 2026-06-01, 18:23 UTC local path: D:\OneDrive...
network path: \\localhost\OneDrive...
The modified script here will do exactly as requested:
If it meets an item within the D:\OneDrive path* (from the Total Commander's source panel),
it changes this to \\localhost\OneDrive-based path* as the URL=value for the target URL file as requested.
* The literal strings there can be changed so the path(s) can be defined dynamically per-machine and or per-user via the $env:OneDrive family variables.
Here, however, I leave the literals on purpose.

So the resulting URL file will become:

Code: Select all

[InternetShortcut]
URL=\\localhost\OneDrive\deeper\path\item.name
instead of:

Code: Select all

[InternetShortcut]
URL=D:\OneDrive\deeper\path\item.name
Please refer to the following section of the script if you need further changes regarding your actual environment:

Code: Select all

# OneDrive and localhost literal definitions
$OneDrive = 'D:\OneDrive'
$localhost = '\\localhost\OneDrive'
In my environment, such "URL=\\localhost\OneDrive" URL files won't work unless a drive letter is explicitly provided (e.g., "URL=\\localhost\D:\OneDrive").
Apparently, in the OP environment, they somehow directly mapped a domain to their D:\ drive, so let it be.

Finally, the script itself (both powershell.exe/Windows PowerShell (5.1) and pwsh.exe/Cross-Platform PowerShell (7+) are supported).
  • makeURLfiles.ps1 script :: version specific to the u/fc62's request

    Code: Select all

    $time = [diagnostics.stopwatch]::StartNew()
    $path = [IO.DirectoryInfo]$pwd.path
    
    if ($path){
    'current working path'|Write-Host -f DarkGray
        $path.FullName
    }
    ''
    if ($args){
    '%WL list file'|Write-Host -f DarkGray
        $list = [IO.FileInfo]$args[0]
        $list.Name
    ''
    '%P source path'|Write-Host -f DarkCyan
        $source = [IO.DirectoryInfo]$args[1]
        $source.FullName
    
    '%T target path'|Write-Host -f DarkCyan
        $target = [IO.DirectoryInfo]$args[2]
        $target.FullName
    }
    ''
    if (-not $args){
        Write-Warning 'no parameters have been passed, exiting...'
        sleep -seconds 3
        exit
    }
    if ($args -and $list.length -le 2){
        Write-Warning '%WL list file is empty, exiting...'
        sleep -seconds 3
        exit
    }
    
    # read input list file and collect items
    $items = [IO.File]::ReadLines($list)|foreach{
       if(-not [string]::IsNullOrWhiteSpace($_)){
           $_
       }
    }
    
    if (-not $items.count){
        Write-Warning '%WL list file contains no items, exiting...'
        sleep -seconds 3
        exit
    }
    
    # OneDrive and localhost literal definitions
    $OneDrive  = 'd:\OneDrive'
    $localhost = '\\localhost\OneDrive'
    
    # process items from %WL list file
    'processing {0} items from %WL list file...' -f $items.count|Write-Host -f Yellow
    
    foreach ($item in $items){
    
    # URL address: if item is within $OneDrive change it to $localhost
    if($item -like "$OneDrive\*"){
        $URL = $item -replace [Regex]::Escape($OneDrive),$localhost
    }
    else {
        $URL = $item # otherwise leave item intact
    }
    # display current URL
    'URL={0}' -f $URL
    
    # uncomment the following line if you need URI-formatted $URL
    #$URL = ([URI]$URL).AbsoluteUri
    
    # URL file contents
        $text=[Text.StringBuilder]::new()
        [void]$text.AppendLine('[InternetShortcut]')
        [void]$text.AppendLine("URL=$URL")
    # URL file destination path and naming
        $base = Split-Path $item -leaf
        $URLfile = [IO.Path]::combine($target,"$base.url")
    # avoid naming collisions
    $counter = 1
    while ([IO.File]::Exists($URLfile)) {
        $URLfile = [IO.Path]::combine($target,"$base($counter).url")
        $counter++
    }
    # write URL file
    [IO.File]::WriteAllText($URLfile,$text,[Text.Encoding]::Unicode)
    }
    ''
    # finalize
    $time.Stop()
    '{0} items processed for {1:mm\:ss\.fff}' -f $items.count,
    $time.Elapsed|Write-Host -f DarkCyan
    'by {0}' -f $MyInvocation.MyCommand.Name
    sleep -seconds 7
    
  • makeURLfiles.ps1 script :: version for other users (no \\localhost\ substitutions in URL=path)

    Code: Select all

    $time = [diagnostics.stopwatch]::StartNew()
    $path = [IO.DirectoryInfo]$pwd.path
    
    if ($path){
    'current working path'|Write-Host -f DarkGray
        $path.FullName
    }
    ''
    if ($args){
    '%WL list file'|Write-Host -f DarkGray
        $list = [IO.FileInfo]$args[0]
        $list.Name
    ''
    '%P source path'|Write-Host -f DarkCyan
        $source = [IO.DirectoryInfo]$args[1]
        $source.FullName
    
    '%T target path'|Write-Host -f DarkCyan
        $target = [IO.DirectoryInfo]$args[2]
        $target.FullName
    }
    ''
    if (-not $args){
        Write-Warning 'no parameters have been passed, exiting...'
        sleep -seconds 3
        exit
    }
    if ($args -and $list.length -le 2){
        Write-Warning '%WL list file is empty, exiting...'
        sleep -seconds 3
        exit
    }
    
    # read input list file and collect items
    $items = [IO.File]::ReadLines($list)|foreach{
       if(-not [string]::IsNullOrWhiteSpace($_)){
           $_
       }
    }
    
    if (-not $items.count){
        Write-Warning '%WL list file contains no items, exiting...'
        sleep -seconds 3
        exit
    }
    
    # process items from %WL list file
    'processing {0} items from %WL list file...' -f $items.count|Write-Host -f Yellow
    
    foreach ($item in $items){
    
    # get URL (can be post-processed if needed, or used as it is)
    $URL = $item
    
    # display current URL
    'URL={0}' -f $URL
    
    # uncomment the following line if you need URI-formatted $URL
    #$URL = ([URI]$URL).AbsoluteUri
    
    # URL file contents
        $text=[Text.StringBuilder]::new()
        [void]$text.AppendLine('[InternetShortcut]')
        [void]$text.AppendLine("URL=$URL")
    # URL file destination path and naming
        $base = Split-Path $item -leaf
        $URLfile = [IO.Path]::combine($target,"$base.url")
    # avoid naming collisions
    $counter = 1
    while ([IO.File]::Exists($URLfile)) {
        $URLfile = [IO.Path]::combine($target,"$base($counter).url")
        $counter++
    }
    # write URL file
    [IO.File]::WriteAllText($URLfile,$text,[Text.Encoding]::Unicode)
    }
    ''
    # finalize
    $time.Stop()
    '{0} items processed for {1:mm\:ss\.fff}' -f $items.count,
    $time.Elapsed|Write-Host -f DarkCyan
    'by {0}' -f $MyInvocation.MyCommand.Name
    sleep -seconds 7
    
Last edited by beb on 2026-06-04, 17:37 UTC, edited 3 times in total.
#278521 User License
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53149
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *ghisler(Author) »

In Total Commander 11.58 RC2, I have added a new option to follow .url files in quick view Ctrl+Q:
04.06.26 Added: wincmd.ini [Configuration] QuickViewFollowLinks: Add 4 to also follow .url files pointing to files or directories (32/64)
To use it, set
QuickViewFollowLinks=5
or
QuickViewFollowLinks=6
(4 also works, same as 5).
Author of Total Commander
https://www.ghisler.com
User avatar
beb
Power Member
Power Member
Posts: 762
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *beb »

2ghisler(Author)
I can confirm, it works great for the regular paths like URL="d:\path\to\my\file.name" or URL="d:\path\to\my\folder",
and for URI paths like URL="file:///d:/path/to/m%20y/fi%20le.name" or URL="file:///d:/path/to/m%20y/fol%20der".

However, it does not work with ones like URL="\\localhost\d:\path\to\my\file.name" or URL="\\localhost\d:\path\to\my\folder"; in this case, Ctrl+Q shows the URL files' literal content like "[InternetShortcut]URL=...", not the content of the URL targets.

At the same time, we can see normal paths to the targets for all the examples in the tooltips, which indicates the system recognizes them equally:
"URL=d:\path\to\my\file.name" > tooltip > "file:///d:/path/to/my/file.name"
"URL=file:///d:/path/to/m%20y/fi%20le.name" > tooltip > "file:///d:/path/to/m%20y/fi%20le.name"
"URL=\\localhost\d:\path\to\my\file.name" > tooltip > "file:///d:/path/to/my/file.name"
#278521 User License
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53149
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *ghisler(Author) »

However, it does not work with ones like URL="\\localhost\d:\path\to\my\file.name" or URL="\\localhost\d:\path\to\my\folder"; in this case, Ctrl+Q shows the URL files' literal content like "[InternetShortcut]URL=...", not the content of the URL targets.
Where can I find the specification of these? They are neither valid URLs nor valid paths.
Author of Total Commander
https://www.ghisler.com
User avatar
beb
Power Member
Power Member
Posts: 762
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *beb »

ghisler(Author) wrote: 2026-06-05, 09:45 UTC Where can I find the specification of these? They are neither valid URLs nor valid paths.
I'm afraid there are no such sources, because, as you rightfully pointed out, they are neither valid URLs nor valid paths, even if they are similar to valid ones.
https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats
However, Windows Explorer recognises such URLs and follows the paths; Total Commander doesn't.
Maybe Explorer just makes a kind of substitution to read such a path (e.g., replacing colon with $, or so).
Please note, I'm not asking you to support that in TC, even if the Explorer does, it's just more out of curiosity.

Edit:
I explicitly asked an LLM:
But Windows Explorer still somehow recognises such a path.
Yes, Windows Explorer understands it because it automatically corrects the path behind the scenes.
How Windows handles it:
UNC conversion:
Windows Explorer treats \\localhost as a network shortcut pointing back to your own machine.
Hidden Shares:
Windows automatically creates hidden administrative shares for your drives (like D$ for the D: drive).
The Magic Translation:
When you type \\localhost\d:\path\file.name, Windows Explorer strips out the invalid colon (:) and silently converts it to \\localhost\d$\path\file.name to access the file.
Why this fails in web browsers and applications:
Web browsers and applications strictly follow Internet standards (RFCs) rather than Windows shortcuts.
A browser will look for a literal folder named d: on the network, fail to find it, and throw an error.
#278521 User License
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53149
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *ghisler(Author) »

I see, so I just need to remove \\localhost\ at the start if the path starts with \\localhost\?: (? stands for any drive letter).
I think I can support that for Ctrl+Q.
Did you create such URLs yourself, or were they created by a program?
Author of Total Commander
https://www.ghisler.com
User avatar
beb
Power Member
Power Member
Posts: 762
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *beb »

ghisler(Author) wrote: 2026-06-09, 08:20 UTC Did you create such URLs yourself, or were they created by a program?
Well, I made them within my script to address fc62 specific request regarding URL files with "\\localhost\OneDrive..." paths:
beb wrote: 2026-06-03, 08:47 UTC
fc62 wrote: 2026-06-01, 18:23 UTC local path: D:\OneDrive...
network path: \\localhost\OneDrive...
In my environment, such "URL=\\localhost\OneDrive" URL files won't work unless a drive letter is explicitly provided (e.g., "URL=\\localhost\D:\OneDrive")...
Since I couldn't reproduce the requested "\\localhost\OneDrive..." paths, I just tried "\\localhost\d:\path\to\my\own\OneDrive..." instead for the script tuning in my environment.
As soon as the script proved to work with that, I removed my local OneDrive part and published its version with "\\localhost\OneDrive..." so fc62 could use it as requested.
At that time, I did not pay attention to whether the "\\localhost\d:\path\to\my\own\OneDrive" path was valid or not in the eyes of high standards; it just worked for its mission.
#278521 User License
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53149
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *ghisler(Author) »

The reason why I ask is that this is very unusual - you either write a local path d:\path\to\.. or an UNC path like \\server\share\path\to\.., but I had never seen a mis of the two.
Author of Total Commander
https://www.ghisler.com
User avatar
beb
Power Member
Power Member
Posts: 762
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *beb »

fc62 wrote: 2026-05-25, 17:27 UTC After contacting Microsoft support, I received confirmation that:
.lnk files (Windows shortcuts) are no longer supported for synchronization via OneDrive desktop client (by design, not a bug)...
By the way, I've suddenly understood why Microsoft did so.
As soon as users' Desktops (with "%UserProfile%\Desktop" folder as a primary contents source) were involved in the cloud synchronization, users en masse met a bunch of dysfunctional/corrupted .LNK links on their different machines (because some apps installed on one machine were non-existant on the others, had other install paths, some links may lead to different/non-existent locations outside of the cloud, and so on), while the Desktop itself is the first visual thing people see before their eyes when turning on their PC (after the logon screen).
I believe Microsoft stumbled on an avalanche of complaints, to say the least. So they just decided to ban the .LNK synchronization outright, entirely, and globally, not bothering with making it configurable, finding fit-for-all relevant solutions, workarounds, etcetera.
#278521 User License
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53149
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *ghisler(Author) »

In RC3, I have now added support for \\localhost\drive\path URLs, please test it!
09.06.26 Fixed: Quick view panel (Ctrl+Q): When using option QuickViewFollowLinks with value 4, handle .url files with path in the form URL=\\localhost\d:\directory (32/64)
Author of Total Commander
https://www.ghisler.com
User avatar
beb
Power Member
Power Member
Posts: 762
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *beb »

2ghisler(Author)
I have tried it for some tens of the URL files with paths to .doc, .docx, .jpg, .mp3, .mp4, .pdf, .ps1, .xlsx, etc. files, and to directories as well; with paths both in "\\localhost\drive:\path" and "drive:\path" formats, along with "file:///disk:/spaced%20path/spaced%20files.ps1" paths.
Their Ctrl+Q previews are safe and sound; everything is running great.
Thank you!
#278521 User License
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
fc62
Junior Member
Junior Member
Posts: 64
Joined: 2007-02-06, 16:30 UTC

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *fc62 »

beb wrote: 2026-06-10, 08:36 UTC
fc62 wrote: 2026-05-25, 17:27 UTC After contacting Microsoft support, I received confirmation that:
.lnk files (Windows shortcuts) are no longer supported for synchronization via OneDrive desktop client (by design, not a bug)...
By the way, I've suddenly understood why Microsoft did so.
As soon as users' Desktops (with "%UserProfile%\Desktop" folder as a primary contents source) were involved in the cloud synchronization, users en masse met a bunch of dysfunctional/corrupted .LNK links on their different machines (because some apps installed on one machine were non-existant on the others, had other install paths, some links may lead to different/non-existent locations outside of the cloud, and so on), while the Desktop itself is the first visual thing people see before their eyes when turning on their PC (after the logon screen).
I believe Microsoft stumbled on an avalanche of complaints, to say the least. So they just decided to ban the .LNK synchronization outright, entirely, and globally, not bothering with making it configurable, finding fit-for-all relevant solutions, workarounds, etcetera.
I fully understand that this could be a valid reason for choosing not to synchronize .lnk files. However, in my opinion, as I personally experienced, there are still possible alternatives and workarounds that could address the issue.
What I find difficult to understand is why this limitation on synchronizing .lnk files applies only to OneDrive Personal, while in the Business version everything is still working correctly as before, at least for now. Even Microsoft Support has not been able to provide a clear explanation, despite the fact that they continue to follow up with me after I reported several possible ways to work around the problem.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 7579
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *Horst.Epp »

2fc62
It doesn't help normal users that the Business version still works for you.
Windows 11 Home, Version 25H2 (OS Build 26200.8875)
TC 11.58 x64 / x86
Everything 1.5.0.1417b (x64), Everything Toolbar 2.4.1
QAP 12.3 x64, Listary Pro 7.0.0.5 beta
User avatar
beb
Power Member
Power Member
Posts: 762
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *beb »

fc62 wrote: 2026-06-10, 16:31 UTC I fully understand that this could be a valid reason for choosing not to synchronize .lnk files. However...
2fc62
Well, that's a helluva point for another discussion.

However, returning to this topic, does the updated version of the script (p=485101#p485101) produce the URL files working in your environment regarding the requested "\\localhost\OneDrive\..." paths?

Also, regarding your question here:
fc62 wrote: 2026-05-31, 18:40 UTC Second question:
In Total Commander, I frequently use Ctrl+Q (or F3) to preview files — I believe this is one of its most useful features...
I hope you've noticed, ghisler(Author) has introduced the entirely new TC function (which is by itself a hairbreadth unbelievable miracle! (regarding there weren't direct requests to do that)) that specifically addresses your question:
ghisler(Author) wrote: 2026-06-04, 10:55 UTC In Total Commander 11.58 RC2, I have added a new option to follow .url files in quick view Ctrl+Q:
04.06.26 Added: wincmd.ini [Configuration] QuickViewFollowLinks: Add 4 to also follow .url files pointing to files or directories (32/64)
To use it, set
QuickViewFollowLinks=5
or
QuickViewFollowLinks=6
(4 also works, same as 5).
Is it working for you?

We'd love to get your feedback on this.

NB
I can't test these paths on my end, so I'm relying on you to check if the script runs correctly.
#278521 User License
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
User avatar
beb
Power Member
Power Member
Posts: 762
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: OneDrive no longer syncs .lnk files (since April) – quick way to create .URL links in Total Commander?

Post by *beb »

By the way, the newly implemented function is cool af by itself.
I really enjoy it. And in most cases, not even third-party plugins required; Lister handles a lot of things, e.g.:
https://x02.me/i/CXY6HK.png

Moreover, in the case of fc62 with uLister.
fc62 wrote: 2026-05-31, 18:40 UTC Second question:
In Total Commander, I frequently use Ctrl+Q (or F3) to preview files — I believe this is one of its most useful features. Among the various plugins, I use ulister (lister), which gives me the best results for most file types...
I also hope you are informed that there's a fork of uLister in active development:
https://github.com/evgen0xb/uLister/releases
#278521 User License
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
Post Reply