SourceInsight通配符
Command Line Substitutions
Both the Run text box, and the Dir text box can contain meta-characters that cause the following items to be substituted in the string.
Character |
Expands to |
Example |
%f |
full path name of the current file * |
c:\myproj\file.c |
%r |
path name of current file relative to the project source directory * |
file.c |
%n |
leaf name of the current file * |
file.c |
%d |
directory path of the current file |
c:\myproj |
%h |
directory path of current file without the drive letter |
\myproj |
%b |
leaf name of current file w/o extension * |
file |
%e |
extension of the current file |
c |
%c |
drive letter of the current file |
c: |
%p |
the current project name |
c:\myproj\myproj |
%j |
the source directory of the current project |
c:\myproj |
%J |
the data directory of the current project |
C:\Documents and Settings\Jim Smith\Documents\Source Insight 4.0\Projects\Base |
%v |
the drive letter of the current project's source directory |
c: |
%o |
leaf name of the project without path |
myproj |
%l |
the current line number |
any number |
%w |
first word in the selection, or the word under the cursor |
any word |
%s |
name of a temp file where the current selection is saved while the custom command runs. |
d:\tmp\vt0004. |
%a |
the current date |
05-12-02 |
%t |
the current time |
08:23 |
%1 - %9 |
user is prompted for arguments |
any strings |
You can also postfix any of the above characters marked with * with either of the following modifier characters.
Character |
Expands to |
Example |
%o |
for all open files |
%f%o |
%m |
for all modified files |
%f%m |
Variable |
Value |
%APPDATA_DIR% |
The current user’s roaming application data folder. |
%DESKTOP_DIR% |
The Windows desktop folder. |
%LOCAL_APPDATA_DIR% |
The current user’s non-roaming application data folder. |
%MYDOCUMENTS_DIR% |
The current user’s documents folder. |
%PROGRAM_DIR% |
Folder that contains the Source Insight program. |
%PROGRAMFILES_DIR% |
The Windows Program Files folder. Eg. C:\Program Files |
%PROGRAMFILESX86_DIR% |
The 32-bit Program Files folder. Eg. C:\Program Files (x86) |
%PROJECT_DATA_DIR% |
The current project’s data directory, which contains the data files maintained by Source Insight. |
%PROJECT_SOURCE_DIR% |
The current project’s source directory root, which is set in Project Settings. |
%PROJECT_NAM%E |
The simple name of the current project, with no extension or path. |
%SHARED_DOCUMENTS_DIR% |
The public or shared Windows document folder. |
%SOURCEINSIGHT_USER_DIR% |
The current user’s Source Insight document folder. This is typically C:\Users\<user-name>\Documents\Source Insight 4.0 |
%TEMP_DIR% |
The temp file directory where Source Insight creates temp files. |
%WINDOWS_DIR% |
The Windows directory. |
ShellExecute Examples
Here are some useful examples showing how to use ShellExecute.
Action |
Custom Command Run String |
To browse to a web site: |
ShellExecute open http://www.somewebsite.com |
To explore your Windows documents file folder: |
ShellExecute explore "C:\Documents and Settings" |
To launch Internet Explorer: |
ShellExecute "" iexplore |
To preview a file in Internet Explorer: |
ShellExecute "" iexplore %f |
To search for files in the current project folder: |
ShellExecute find %j |