Problem with functions @int @decimal and identifying Powershell as a shell.

Nov 16, 2019
3
0
Hello!

I have two problems. One of them is problem with proper functioning of @int and @decimal function. Whenever I try to count integer and decimal part of a number, program skips the decimal point.
Second the program cannot identify Powershell as shell being used. Instead it is identified as cmd.

This is my first time when I use Take Command and I'm writing program, so be understanding :)

 
Last edited:
May 20, 2008
11,285
95
Syracuse, NY, USA
I think @INT and @DECIMAL work as documented. According to the help, ignoring the decimal point is intended.

Second the program cannot identify Powershell as shell being used. Instead it is identified as cmd.
What program fails to identify Powershell? How does it try?
 
Nov 16, 2019
3
0
I tried to use %comspec% variable (which works with Take Command and cmd) to identify in which shell I'am, but I read somewhere that powershell doesn't operate with %comspec%, so I'am stuck now.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,423
85
Albuquerque, NM
prospero.unm.edu
You're checking whether PowerShell is running your .CMD file? I didn't know PowerShell could run .CMD files. I thought it had its own extension?

Regarding your numeric parsing issue, it is possible that your decimal and thousands separator characters are swapped? If you type
Code:
echo %@eval[1/2]
then the second character should be the current decimal separator.
 
Nov 16, 2019
3
0
I checked this :
Echo %@eval[1/2]
and the result was "0,5" , but I still don't know how to fix it :c

Edit. I changed it in options and now functions @int and @decimal works good

I have one more question how to make condition to check whether entered argument is a number?
@numeric function works with letters but with numbers with periods doesn't work
 
Last edited:
May 20, 2008
11,285
95
Syracuse, NY, USA
I have one more question how to make condition to check whether entered argument is a number?
@numeric function works with letters but with numbers with periods doesn't work
Once the decimal character has been set correctly, @NUMERIC should be OK.

Code:
v:\> echo %@int[-22.77]  %@decimal[-22.77]  %@numeric[-22.77]
-22  77  1
 
May 20, 2008
11,285
95
Syracuse, NY, USA
I tried to use %comspec% variable (which works with Take Command and cmd) to identify in which shell I'am, but I read somewhere that powershell doesn't operate with %comspec%, so I'am stuck now.
Powershell doesn't set COMSPEC but it uses it. If you try to execute a .CMD file in Powershell, Powershell will start whatever command interpreter is specified by %COMSPEC% ... maybe TCC, maybe CMD ... it depends on how Powershell was started (where it got COMSPEC from).
 
May 20, 2008
11,285
95
Syracuse, NY, USA
To be more precise, if I start powershell from TCC and (at the Powershell prompt) execute
Code:
V:\> .\pau.cmd
I see this in TaskMgr.

1573930209344.png


If I do the same after starting Powershell from the Start\Run dialog, I see this in TaskMgr.

1573930338404.png
 
May 20, 2008
11,285
95
Syracuse, NY, USA
Yeah, if you attempt to run a .cmd or .bat file from PowerShell, it will run it using cmd.
That depends. If you start Powershell from TCC it will use TCC to run a cmdfile. I think it (or maybe Windows) is using COMSPEC.

Code:
v:\> ver

TCC  25.00.24 x64   Windows 10 [Version 10.0.18362.476]

v:\> powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6


V:\> type .\ver.cmd                                                                                             @echo off
ver

V:\> .\ver.cmd                                                                                                  
TCC  25.00.24 x64   Windows 10 [Version 10.0.18362.476]

V:\>

Code:
v:\> ver

Microsoft Windows [Version 10.0.18362.476]

v:\> powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6


V:\> .\ver.cmd


Microsoft Windows [Version 10.0.18362.476]

V:\>
 
May 20, 2008
11,285
95
Syracuse, NY, USA
You can see the same phenomenon more emphatically. 2-click this cmdfile in explorer.

Code:
v:\> type ver.cmd
@echo off
ver
pause

I imagine it will open in CMD.

Then (at a TCC prompt) issue

Code:
setp %@pid[explorer.exe] comspec=%comspec

That will set Explorer's COMSPEC to TCC and 2-clicking the cmdfile will open it in TCC.
 
Similar threads
Thread starter Title Forum Replies Date
fishman@panix.com Problem with 27.15 Support 2
M Problem with VSDevCmd.bat in VS 16.7.3 Support 0
R Problem with @INT[ value] in V26 Support 9
M Selecting test "off by one" problem in Take command Support 4
Alpengreis UTF-8 problem in TCC related to Python Support 7
K_Meinhard Small problem in german IDE 26 Support 3
B Problem with color in nested shells Support 1
Joe Caverly Problem creating and switching to a DESKTOP Support 9
vefatica Another popup problem Support 10
Alpengreis ffind dialog (/W) problem Support 4
Alpengreis [TCMD v25.00.24] Small space problem with the DE translation in Prefs-GUI Support 1
Alpengreis [TCMD v25.00.24] Problem with copy and paste and the # char via mouse in TCC Support 6
B IF command problem in tcexit.btm Support 9
fishman@panix.com Problem at Startup of TCC Support 3
P Problem with SFTP copies Support 7
P Problem with FTP copies Support 10
Jay Sage Problem with Context Menu Copy+Paste+Run Key Assignment Support 7
R Problem with %_do_loop in nested do loops Support 2
fishman@panix.com New Problem with later Windows 10 Support 10
Peter Murschall A little problem with LEAVE and COMMENT Support 5
M Handling of %~I problem Support 4
WinLanEm FOR problem Support 18
K Problem With SCRPUT /u Support 3
vefatica What's TCMD's problem with ^e[0m? Support 13
Peter Murschall IDE: RTL with non-English resources-problem is back in Build 28 Support 4
rps Regex problem: \xnn not recognized as a hex character Support 0
rps PRIORITY LOW problem Support 1
old coot Regex problem: \xnn not recognized as a hex character Support 12
vefatica Another problem with build 22. Support 3
Alpengreis [23.x] Download-Problem Support 2
S Problem with " Support 3
C Problem navigating forums Support 11
x13 Problem listing repository files using DIR http(s)://... Support 8
Joe Caverly Problem with TEE in v22 Support 2
Alpengreis Problem with thousands delimiter and colors Support 17
M Take Command 18, migrating to another machine, license problem. Support 1
B TCC 21.01.50 Problem with ALIAS /r and SET /r Support 2
rps How to? @search problem Support 2
WinLanEm @SELECT problem Support 6
T Fixed Problem with use of Batch parameters in the IDE Support 1
Oz Solomon Problem with "list" Support 14
S V21.24 theme problem Support 2
Alpengreis Problem if command prompt is not legacy Support 4
Alpengreis TCMD.INI: The "super hidden" problem ... Support 6
G Odd problem - screen brightness Support 4
rps V20 In-process pipes problem Support 8
Alpengreis Again theme problem [v20.0.21]? Support 11
WinLanEm INPUT problem Support 1
Craig Fitzgerald problem with executable extensons with TCC version 19.10.51 x64 Support 3
mikea How to? Problem with @SFN (short filenames) Support 6

Similar threads