I'm trying to create a batch-file that creates (DIR) junction points; I commonly use. Bellow is a script, which creates multiple links, to the same location.

@echo off
for /f %%i in (input.txt) do (
mklink /j "%%i" "C:\test" )

How do I modify it to use: (input.txt) for links , and then (output.txt) for targets?


Does the input data have to be in two separate files? For example, if your Input.txt looks like this:

Link 1|Target 1
Link 2|Target 2
Link 3|Target 3

Then you can use something like this:

for /f "tokens=1,2 delims=|" %%i in (Input.txt) do @mklink /j "%%i" "%%j"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.