[Python-ideas] Have os.unlink remove junction points on Windows

Paul Moore p.f.moore at gmail.com
Thu Sep 26 09:23:20 CEST 2013

On 26 September 2013 06:37, Kim Gräsman <kim.grasman at gmail.com> wrote:
> I haven't observed any differences on XP or Windows 7. Now I'm stuck
> in an organization where they force all command prompts to be
> elevated, so it's been a while since I was able to test the more
> normal cases.

Er, does this not already work?

>From an elevated Powershell prompt:

PS 08:20 C:\Work\Scratch
>new-symlink symps .\ps.vim

Mode           LastWriteTime       Length Name
----           -------------       ------ ----
-a---    26/09/2013    08:20    <SYMLINK> symps [C:\Work\Scratch\ps.vim]

PS 08:20 C:\Work\Scratch
>type symps
set shell=powershell
set shellcmdflag=-c
set shellquote=\"
set shellxquote=

>From a non-elevated prompt:

PS 08:20 C:\Work\Scratch
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.unlink('symps')
>>> ^Z

PS 08:21 C:\Work\Scratch
>type symps
type : Cannot find path 'C:\Work\Scratch\symps' because it does not exist.
At line:1 char:1
+ type symps
+ ~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound:
(C:\Work\Scratch\symps:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId :


More information about the Python-ideas mailing list