GdP Software logo

Run a Program for all files dropped on a basket

Run Application

This action starts any program, script or application.

Name and Description:

These appear in the Basket Configuration window. It's probably best to use a short Name and save the longer explanation for the Description.

Application Path:

Click the "..." button to select which program to start for the dropped file.

Arguments:

Run the application using these arguments. You can include File Viking Environment Variables, see below.

Work Folder:

Click the "..." button to specify the working folder for the program.

Show Window:

How the program's main window will appear. Some programs ignore this setting.

tip Several example code snippets are at the bottom of this page.

Environment Variables:

Use the Environment Variables to tell your script or program which file to process:

NameDescriptionExample Value
FV_FILE The complete path to the dropped file C:\My Files\Subdir\Hello.txt
FV_FILE_D The complete directory to the dropped file (not the filename) C:\My Files\Subdir\
FV_FILE_N The filename of the dropped file (not the directory) Hello.txt
FV_FILE_B The file "title" of the dropped file (not the directory or extension) Hello
FV_FILE_E The extension filename of the dropped file in UPPERCASE TXT
FV_RELDIR The directory, without drive or filename \My Files\Subdir\
FV_TOTAL This variable contains the number of files dropped on the basket 5
FV_FILENO This variable contains a number in the range 1 to FV_TOTAL. 5
Run any Program on dropped Files

Use in BAT or CMD script

Surround the variable names with quotes (since some may contain spaces) and percentage signs like this:

@echo off
COPY "%FV_FILE%" "D:\My Backups"

Use in VBScript

Surround the variable names with percentage signs like this:

Dim oShell
Set oShell = CreateObject("Wscript.Shell")
FvFile = oShell.ExpandEnvironmentStrings("%FV_FILE%")

Use in Native Windows Programs (C++/Delphi...)

If you create a Windows program, use the Windows API GetEnvironmentVariable like this:

// C++ example, Unicode, error checking omitted
TCHAR fileName[BUFSIZE];
DWORD dwRet = GetEnvironmentVariable(L"FV_FILE", fileName, BUFSIZE);

Use in Managed Code (C# etcetera)

Use the System.Environment class like this:

TheFileName = Environment.GetEnvironmentVariable("FV_FILE");