Hat Windows die ln-s oder gleichwertig?

Ich muss eine Datei mit C:\Windows\System32\drivers\etc\hosts

Wie kann ich das mit Windows machen ? Gibt es einen Softlink wie ln -s oder ein Äquivalent in Windows ?

Author: pun, 2010-08-30

7 answers

Sie suchen den Befehl "mklink".

Dokumentation und Beispiele in Microsoft Docs - oder ss64.com.

Beispiel aus dem link:

// To create a symbolic link named MyDocs from the root directory to the \Users\User1\Documents directory, type:
mklink /d \MyDocs \Users\User1\Documents
 42
Author: scigor,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2018-11-26 20:01:33

Es mag andere Wege geben, aber die, mit der ich vertraut bin, ist mklink:

C:\>mklink 
Creates a symbolic link.

MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    specifies the new symbolic link name.
        Target  specifies the path (relative or absolute) that the new link
                refers to.
 17
Author: Matthew S,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2010-11-19 05:43:48

Es gibt junctions aber ich weiß nicht, ob dieses wird genau das tun, was Sie brauchen.

Edit-oops sorry, dies gilt nur für Verzeichnisse nicht Dateien

 3
Author: Martin Beckett,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2010-08-30 15:56:19

Wie @inf sagt, ist mklink die Lösung für Vista und höher.

Für 2000 / XP können Sie fsutil hardlink verwenden. Beachten Sie, dass Hardlink im Gegensatz zu mklink nicht laufwerksübergreifend funktioniert.

 2
Author: studgeek,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2011-09-12 01:44:50

Link Shell Extension - kann symbolischen link erstellen (unter anderem). Schöne Kontextmenü-integration. Verfügbar für die neuesten Windows-Versionen und häufig aktualisiert.

 2
Author: Francois,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2021-02-03 22:26:46

Powershell -

Solange Microsoft rät, powershell seit mehr als 5 Jahren als Befehlsinterpreter zu verwenden und cmd.exe zu einer Legacy-Anwendung wird, fehlt dieser Frage eine Antwort in Powershell:

New-Item -path ~\Desktop\hosts -itemType SymbolicLink -target c:\Windows\System32\Drivers\etc\hosts

Dies funktioniert ab Powershell v5. 0

 1
Author: maoizm,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2018-05-27 11:31:32

Öffnen Sie das Terminal/CMD geben Sie unter android/sdk/tools

- Terminal** ln -s emulator64-x86-emulator-x86** CMD - mklink emulator64-x86-emulator-x86 -

Dies wird wie erstellt..

Symbolischer Link erstellt für emulator64-x86 > emulator-x86

 -2
Author: Intra,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2018-04-04 21:49:37