command line parameters / file associations

Jun 6, 2011
3
0
I just upgraded from TCMD9 to TCMD12 and I'm seeing some different functionality when running a Perl script from the command line.

I have a Windows file association that links perl.exe with the file extension ".pl"

I am getting different TCMD functionality when:
1) I rely on the ".pl" file association to start Perl; AND
2) I pass parameters to the Perl script.

The Perl script test_argv.pl is just 1 line:
print "argv[0]: $ARGV[0]\n";

In TCMD12:
[w:\]test_argv.pl robert
argv[0]:

[w:\]perl test_argv.pl robert
argv[0]: robert

In TCMD9:
[w:\]test_argv.pl robert
argv[0]: robert

I prefer the functionality of TCMD9.

The TCMD12 functionality is problematic because I have many batch files that just call the perl script without specifically calling perl.exe.

Is there an option I haven't set properly in TCMD12?
 
May 20, 2008
3,515
4
Elkridge, MD, USA
From: rsternlieb
| I just upgraded from TCMD9 to TCMD12 and I'm seeing some different
| functionality when running a Perl script from the command line.
|
| I have a Windows file association that links perl.exe with the file
| extension ".pl"

You should display both the file association (which associates an extension to a "filetype"; multiple extensions can be associated with the same filetype), AND the command to process the "filetype". You can use the ASSOC command for the first, and the FTYPE command for the second. A frequent problem with FTYPE is that (unlike TCC's executable extensions) it is necessary to indicate that command line parameters specified in TCC must be passed on to the target program's command line explicitly, e.g. as "%1" %*.

Did you be any chance set .PL as an executable extension in V9 but not in V12? Type "which x.pl" (where x.pl is a file) to see how it is interpreted by TCC (TCMD).
--
Steve
 
Jun 6, 2011
3
0
From: rsternlieb
| I just upgraded from TCMD9 to TCMD12 and I'm seeing some different
| functionality when running a Perl script from the command line.
|
| I have a Windows file association that links perl.exe with the file
| extension ".pl"

You should display both the file association (which associates an extension to a "filetype"; multiple extensions can be associated with the same filetype), AND the command to process the "filetype". You can use the ASSOC command for the first, and the FTYPE command for the second. A frequent problem with FTYPE is that (unlike TCC's executable extensions) it is necessary to indicate that command line parameters specified in TCC must be passed on to the target program's command line explicitly, e.g. as "%1" %*.

Did you be any chance set .PL as an executable extension in V9 but not in V12? Type "which x.pl" (where x.pl is a file) to see how it is interpreted by TCC (TCMD).
--
Steve

Thanks Steve.
TCC9 and TCC12 give identical results for assoc x.pl, ftype x.pl, and which x.pl:
[w:\]assoc test_argv.pl
TCC: File association not found for extension "test_argv.pl"

[w:\]ftype test_argv.pl
TCC: File type not found or no open command associated with "test_argv.pl"

[w:\]which test_argv.pl
test_argv.pl is associated with : C:\Program Files\Perl\bin\perl.exe
The path is the same for both TCMD versions.
The environment variables (set > tcmdxx.txt) are the same for both TCMD versions.

----
Rob
 
Jun 6, 2011
3
0
Try

assoc .pl

Hi David.
Well, that is slightly embarrassing. I should have caught that.
Both TCC9 and TCC12 have ".pl=Perl"


- - - - - - - - - - - - - - -
Here are two new things that may lead to a resolution.

a)
I created a new "die.pl" perl script. The contents of the script is simply "die;" (without the quotes).

When I run "die.pl" from the TCC9 command prompt I get:
[w:\]die.pl
Died at W:\die.pl line 1.

When I run "die.pl" from the TCC12 command prompt I get a Windows GUI Error box that says:
PerlScript Error
[Line:0] (in cleanup) Died

When I run "perl die.pl" from either TCC9 or TCC12 I get:
[w:\]perl die.pl
Died at W:\die.pl line 1.

- - - - - - - - - -
b)
There is a $^X Special Variable in Perl that returns (From Programming Perl 2nd) "The name that the Perl binary itself was executed as, from C's argv[0]" and this gives different results in TCC9 vs. TCC12.

With the contents of env.pl being only 'print ">>$^X\n<<";':


Results from TCC9:
[w:\]env.pl
>>TCC<<
Results from TCC12:
[w:\]env.pl
>>C:\progra~1\Perl\bin\PerlSE.dll<<

When running 'perl env.pl' from either TCC9 or TCC12 the results are the same:
[w:\]perl env.pl
>>F:\perl\bin\perl.exe<<
So, there are definite differences.
-----
Rob
 
Similar threads
Thread starter Title Forum Replies Date
old coot LEAVE appears to affect command-line arguments Support 11
T VIEW only works from command line Support 14
vefatica `Back quotes` - command line vs. batch file Support 5
Phileosophos Is there any way to open the Take Command options dialog from the command line? Support 8
Phileosophos Command-line Editing Shortkeys That Fail Support 6
D Open Windows 10 Photos app from command line Support 11
fpefpe How to? command echo in title line/bar Support 2
vefatica Command line DO with no closing parenthesis? Support 9
R Long commands retrieved from command history have blank line when wrapped Support 20
D Double Quote in TC Tool Bar Button Command line Support 3
Joe Caverly Expand all aliases on the command line Support 2
Jay Sage Cannot Postion Cursor in Command Line Using Mouse Support 7
vefatica IDE.EXE's command line? Support 19
D btm file command line augments comparing for string or math. Support 12
P Escape key no longer clears command line in v24 Support 21
J File explorer handling from command line? Support 2
M Ctrl-C when using command line history does nothing Support 2
M Command line parsing differences between cmd.exe and TCC Support 6
C Replace 1st argument on command line Support 4
K Command Line Selection Not Working Support 12
J Error running Python at command line Support 9
rps How to? Alias/Command line use of *log on/off Support 2
x13 //directive ignored on TCC command-line Support 4
J How to? max. practical command line length? Support 3
mfarah WAD Odd behaviour with command-line arguments on TCMD. Support 7
thorntonpg F1 on command line The webpage cannot be found Support 5
J Python: TCC command line parsing removes '=' equal sign characters Support 4
L Fixed console line length in Take Command 19? Support 3
C LOG entry for TCMD/TCC command line Support 15
H command line parsing question Support 5
Joe Caverly How to? Date Range in command line for 7zip /= Support 1
cgunhouse One of the Focuses of V17 Beta Testing Should Be Command Line Parsing Support 1
cgunhouse Jabber Command Line Option Being Transmitted -- Fixed with Build 42 Support 2
M Hotkey-mechanism, for doing something with the current command-line Support 4
J Passing % character through command line to .btm Support 5
vefatica Command line SETLOCAL? Support 11
tmaynard How to? Control-U alias for Escape (command line editing) Support 5
BobK How to? Handling filenames with blanks at command line Support 3
CWBillow Send Command-line with prompt? Support 6
M Missing PERL command-line arguments Support 1
fpefpe WAD Python support does not process command line Support 14
vefatica SENDMAIL, command line override SMTP server? Support 2
vefatica (OT) Show desktop from command line? Support 20
M Starting Windows GUI programs from the command line... Support 10
A How to? Remove last argument on command line Support 4
nickles Reload tcmd.ini from the command line Support 11
A How to? Invoke View Clipboard from command line Support 8
ehab aboudaya How to? activate tab with same directory in command line Support 6
A minor documentation fix - command line editing Support 0
A Minor documentation fix ["-" on command line] Support 3

Similar threads