RTL.SymLink Sample

From RAD Studio XE2 Code Examples
Jump to: navigation, search

Language:

Contents

This sample demonstrates how to create a symbolic link for a file.

Location

You can find the SymLink sample project at:

Description

This sample is a Delphi console application that allows the user to create a symbolic link file for a target file.

How to Use the Sample

  1. Navigate to Start > Programs > Embarcadero RAD Studio > Samples and open symlink.dproj.
  2. Build symlink.exe.
  3. You can either:
    1. Set the names of the symlink file and target file in the Run > Parameters dialog and then press F9 or choose Run > Run.
    2. In the command line, navigate to the folder where the symlink executable was created and use the symlink [LinkFile] [TargetFile] command.

Files

The project has one file, symlink.dpr, which contains the main program source module.

Classes

There are no classes in this application. The .dpr file is responsible for creating the symbolic link file based on the command-line parameters provided by the user.

Implementation

  • The TFile.CreateSymLink method is used to create the symbolic link file.
  • ParamCount and ParamStr are the functions used to handle the command-line parameters.
  • In order to create the symlink file, it must not already exist.

Uses

See Also

Personal tools
Previous Versions