com.erigir.mslinks

MSLinks - library for creating native Windows links

Лицензия

Лицензия

Группа

Группа

com.erigir
Идентификатор

Идентификатор

mslinks
Последняя версия

Последняя версия

0.0.2+5
Дата

Дата

Тип

Тип

jar
Описание

Описание

com.erigir.mslinks
MSLinks - library for creating native Windows links
Ссылка на сайт

Ссылка на сайт

https://github.com/BlackOverlord666/mslinks
Организация-разработчик

Организация-разработчик

BlackOverlord666
Система контроля версий

Система контроля версий

https://github.com/BlackOverlord666/mslinks

Скачать mslinks

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.erigir/mslinks/ -->
<dependency>
    <groupId>com.erigir</groupId>
    <artifactId>mslinks</artifactId>
    <version>0.0.2+5</version>
</dependency>
// https://jarcasting.com/artifacts/com.erigir/mslinks/
implementation 'com.erigir:mslinks:0.0.2+5'
// https://jarcasting.com/artifacts/com.erigir/mslinks/
implementation ("com.erigir:mslinks:0.0.2+5")
'com.erigir:mslinks:jar:0.0.2+5'
<dependency org="com.erigir" name="mslinks" rev="0.0.2+5">
  <artifact name="mslinks" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.erigir', module='mslinks', version='0.0.2+5')
)
libraryDependencies += "com.erigir" % "mslinks" % "0.0.2+5"
[com.erigir/mslinks "0.0.2+5"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

mslinks

Summary

Library for parsing and creating Windows shortcut files (.lnk)

Description

Partial implementation of Shell Link (.LNK) Binary File Format

This library allows you create new and read and modify existing .lnk files. It can edit most properties of the link such as working directory, tooltip text, icon, command line arguments, hotkeys, create links to LAN shared files and directories but following features are not implemented:

  • extra data blocks: Darwin, IconEnvironment, KnownFolder, PropertyStore, Shim, SpecialFolder
  • some options in LinkTargetIDList because this section is not documented
  • environment variables: you can use it in target path but it resolves while creating link and not stored in the lnk file (the reason is previous item)

Examples

Easiest way to create link with default parameters: ShellLink.createLink("targetfile", "linkfile.lnk")

Following example demonstrates creating link for .bat file and setting working directory, icon and setting up font parameters for console

package mslinks;

import java.io.IOException;

public class Main {
	public static void main(String[] args) throws IOException {
		ShellLink sl = ShellLink.createLink("pause.bat")
			.setWorkingDir("..")
			.setIconLocation("%SystemRoot%\\system32\\SHELL32.dll");
		sl.getHeader().setIconIndex(128);
		sl.getConsoleData()
			.setFont(mslinks.extra.ConsoleData.Font.Consolas)
			.setFontSize(24)
			.setTextColor(5);
				
		sl.saveTo("testlink.lnk");
		System.out.println(sl.getWorkingDir());
		System.out.println(sl.resolveTarget());
	}
}

Final example creates cyclic link that blocks explorer on Windows 7 while trying to get into the containing directory

package mslinks;

import java.io.IOException;

public class Main {
	public static void main(String[] args) throws IOException {
		ShellLink sl = ShellLink.createLink("test.lnk");
		sl.getHeader().getLinkFlags().setAllowLinkToLink();
		sl.saveTo("test.lnk");
	}
}

Download

Версии библиотеки

Версия
0.0.2+5