Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Some questions

Nov
33
0
Hi guys, i've two questions:

1) In cmd.exe if i write:
ECHO=%DATE%%TIME%
i get the actual date and the time separated by a space (2012/12/05 10.20.30,00)
Why with Take Command the date and the time are non separated by the space? I must write
ECHO=%DATE% %TIME%
. Do you know explain that?

2) In cmd.exe i can use "REG QUERY". Does it work with Take Command or i must use the "@REGQUERY" function?

Thank you
 
Hi guys, i've two questions:

1) In cmd.exe if i write:
i get the actual date and the time separated by a space (2012/12/05 10.20.30,00)
Why with Take Command the date and the time are non separated by the space? I must write . Do you know explain that?

Not here; on my computer, that command mashes the date and time together in both shells. (%DATE does return the date in a different format in TCC though; CMD.EXE gives the day of the week, TCC doesn't.)

Is it possible that CMD.EXE provides a leading space for one-digit hours? I haven't checked.

2) In cmd.exe i can use "REG QUERY". Does it work with Take Command or i must use the "@REGQUERY" function?

REG.EXE is an external command. You can call it from either shell.
 
Is it possible that CMD.EXE provides a leading space for one-digit hours? I haven't checked.

Later: It seems that CMD.EXE and TCC both supply a leading zero for times before 10:00. The different you're seeing may be because you're running the code at different times, rather than a difference between the two shells.
 
Thank you Charles! Anyway is it correct to write the variables in this format, right?
ECHO=%DATE% %TIME%

For the second question, i prefer to use REG QUERY. In cmd.exe it works, while with Take Command it seems not work (sure my code is bugged). I write an example:

REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentVersion|FIND "6.2">NUL 2>&1&&(
IF "%PROCESSOR_ARCHITECTURE%"=="x86" (
ECHO=You're running Windows 8 x86)
IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
ECHO=You're running Windows 8 x64))||(
IF "%PROCESSOR_ARCHITECTURE%"=="x86" (
ECHO=You're running Windows x86)
IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
ECHO=You're running Windows x64))

What do you think about my code?
 
For the date question i've written a wrong format, sorry. This is the correct using
ECHO=%DATE% %TIME%

CMD -> 05/12/2012[two spaces]4.39.55,45
TCMD -> 05/12/2012[one space]4.39.55,45
 
What do you think about my code?

Frankly, it makes my eyes cross.... Wouldn't it be a lot simpler to just check %_WINVER instead of querying the registry?

I'm not clear on how that doesn't work, but I suspect that kind of construction needs DuplicateBugs=Yes.
 
aedthuio, if you end up using %_winver - and your script needs to work with all regional settings - pay attention to using dot as the decimal separator instead of assuming that the system setting will magically work. Example:
Code:
setdos /G".,"
iff %_winver% GT 5.2 then
  echo after WinXP
elseiff %_winver GT 6.0 then
  echo after ...
endiff
setdos /G0
Without the SETDOS /G commands the code above will subtly fail on some regional settings.
Give the same treatment to %_4ver%.
And pay attention to %@ functions. One notable pitfall:
Code:
set c23=X%@if[%_4ver GE 14,Y]
on systems with English regional settings you get c23=XX when TCC's version is below 14 and c23=XY otherwise.
But on systems wihere comma is the decimal separator you get c23=X%@if[%_4ver GE 14,14,02,X] (for TCC version "14,02") which yields an unexpected c23=X14 in some cases.
 
Hi guys, i've a new problem, could you help me please? This is my batch:

Code:
SET "Opening=Opening %%~nA..."
 
FOR /R %%A IN (filename.exe*) DO (
        SET _=T
        ECHO=%Opening%>>"%~dp0log.txt"
        START "" /MIN /WAIT "%%A")

If "filename.exe" exists it should write a "log.txt" file with written:

Opening filename...

With cmd.exe all works, while with tcmd.exe the log file is:

Opening ...

TCMD.ini has already the "DuplicateBugs=Yes". Thank you
 
Code:
SET "Opening=Opening %%~nA..."


You're putting one of those CMD.EXE FOR-variable things inside an environment variable. I don't know whether Rex intended to support such a construction. (In fact, I can't even find any documentation of any of that FOR-variable stuff anywhere in the help file; I'd consider it a bonus that it even works outside an environment variable.)

I'd respectfully suggest that you let go of FOR; it's inherently a single-line construct, and its peculiar syntax is unusable everywhere else. Instead, consider rewriting your loop to use DO:

Code:
do file in filename.exe*
   echo Opening %file >>! "%@path[%_batchname]log.txt"
   start "" /min /wait "%file"
   rem ...
enddo
 
Thank you Charles, i've found that if the "SET" command is inside the "FOR" all works:

Code:
FOR /R %%A IN (filename.exe*) DO (
        SET "Opening=Opening %%~nA..."
        ECHO=%Opening%>>"%~dp0log.txt"
        START "" /MIN /WAIT "%%A")

Does exist a way to fix it keeping the SET outside the FOR?
 

Similar threads

Back
Top