Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

CONSET - Display/Set/Delete EnVars + float p. math + ..[CMD]


  • Please log in to reply
8 replies to this topic
BoBo
  • Guests
  • Last active:
  • Joined: --

CONSET - User Manual

ConSet.exe - Displays, sets, or deletes cmd.exe environment
variables, modifies console parameters, and performs floating point
mathematics.

v1.4, 2002.06.06 - Windows NT 4.0, X86

SYNOPSIS

SIMPLIFIED
[options] [name[=[value]]

DETAILED
[/E] [/N] [/Q] [/V] [/X] [/PID=pid#] [[/CD] [/RANDOM] [/S] | [/D string]
| [/TIME [h+/-#] [m+/-#] [s+/-#] | /DATE [y+/-#] [m+/-#] [d+/-#] |
[/A [/B|/I|/F|/O|/X] expr| name=value] | [/M &|
/T &| /U name[=[value]]] | [name[=[value|`command`]]]]]

LICENSE
Unlimited use and unlimited distribution as a free product.

DESCRIPTION
OVERVIEW
ConSet serves two primary functions: the first is to display and
manipulate CMD.EXE environment variables; the second is to adjust the
console window's parameters. ConSet combines all of the functions of
CMD.EXE's built-in SET command and the primary functions of the
resource kit's SETX program with a floating point math library and
some console adjustment tools.

When ConSet is run without any parameters the current environment is
printed. If a variable name or part of a variable name is specified,
only variables with matching names will be printed. A match will
occur if the string specified matches all or the beginning portion of
a variable name. If a variable name is followed by an equal sign and
nothing else, that variable will be deleted from the current
environment. If the equal sign is followed by any text, the variable
will be defined with that text. This default behavior can be modified
by the presence of any of the options in the section titled OPTIONS.

A variable can also be set from a pipe or redirected STDIN if the
command line ends at the equal sign: 'COMMAND|ConSet VAR1=' and
'ConSet VAR= that
character must either be escaped with the escape character
(a=^^1,b=a^&1) or the entire expression enclosed in quotes
("a=^1,b=a&1"). The foregoing does not apply to expressions in an
input file. Whitespace is permitted in most places.

Numbers:
All numbers are used and stored as long doubles (80-bit), except
that bitwise operators will truncate the effected numbers to 64-
bit integers. The use of floating point numbers on computers is
inherently inaccurate and the user should be cautious of rounding
errors. Precision may be limited by setting the variable
%ConSet_prec% with the desired number of digits. For example, '
ConSet_prec=6' for six digit precision. The default is 20. Numbers
may be entered in scientific notation (i.e. 1.2E2=12 and
1.2e-2=0.12).

Number bases:
Numbers may be input as decimal, binary with the prefix 0b,
hexadecimal with the prefix 0x, and octal with the non-standard
prefix 0o ('zero-oh'). This program is intended to be a
solution to many scripting problems and the standard octal
prefix of 0 only creates an additional problem. The default
output is in base 10. To force the output to one of the other
supported bases, append the corresponding flag character to the
switch (/AO=octal, /AX=hex, and /AB=binary) for integers, or the
flag character and a period (i.e. /AB.) for floating point. For
traditional octal output, use /AOF.

Variables:
Variable names must begin with an alphabetic character or the
character '@' and they may contain numerals or any of the
following characters enclosed in the double quotes: "`@#_\'".
Variable names need not be enclosed in percent signs unless they
violate the foregoing rule. If they are variables which a value
will be stored to, such as lvalues and variables which use the
increment and decrement operators, they must not be enclosed in
quotes. Variables beginning with the character '@' are local to
the current instance of ConSet only (Ex: @a=5,@a+1). Variables may
contain expressions consisting of values and other defined
variables. Undefined variables will produce an error; they are not
SET to zero as set will do.

List and array variables:
Multi-element variables can be indexed as lists and arrays in
mathematical expressions. An array is a table of one or more rows
with one or more columns in each row. Arrays require an index for
the row followed by an index for the column. A list is an array of
only one row and requires only the single index. Indexes are
specified in square brackets following the variable name using the
format LIST[element] and ARRAY[row][column]. Indexes are zero-
based and the specified elements must exist. Individual elements
in a row are delimited by spaces or commas and rows are delimited
by semicolons or linefeeds. If a list or array variable is
included in an expression without an index, it will be read as an
expression. Two methods are provided for creating lists and one
for creating arrays (see seq() and {}).

Ex: "list=seq(30+((5546 SET>>month)&1),Month,1,1,12)"
Ex: mat={2000 2001 2002;29 28 28}
Ex: list[Month-1]=mat[0][Year]==2000?mat[1][Year]:0

Internal constants (case sensitive):
$c Speed of light (2.99792458e8 m/s).
$d Convert degrees to radians (i.e. cos(60$d)).
$g Acceleration of gravity (9.80665 m/s**2).
$G Gravitational constant (6.67259e-11 m**3/(kg s**2)).
$m Convert minutes to radians.
$s Convert seconds to radians.
$r Convert radians to degrees (i.e. acos(.5)$r)
$e e, the base of natural logs.
$p Pi, ratio of circumference to diameter of a
circle.
$z Time bias in minutes (UTC=local time+$z/60).

Supported operators in order of precedence:
Implied multiplication is enabled. To imply multiplication of
variables, separate the variables with a space.

# Comment. Ignore everything until the next delimiter.
{ } Defines a set and must be used alone in a comma
delimited expression (Ex:
/A x={0 1 2;10 11 12}, 5x[0][1]).
:= Assigns an expression to a variable. Use this
operator when the expression should be assigned
without evaluation. Use backquotes to assign an
element of a list or matrix (Ex:
/a var:=`matrix[0][1]`).
( ) Grouping.
++ -- Pre and post increment and decrement.
** func Power (x**2 is x squared) and all functions.
!expr ~ Logical negation (results in 0 or 1) and bitwise
complement.
expr! Factorial. Uses e^(lng(x+1)) for non-integers.
% / * Modulus (x-y*ipart(x/y), use %% in scripts),
division, and multiplication. Excess modulus
operators are ignored.
+ - Addition and subtraction.
>> << Bitwise right and left shifts.
>= > <= < Comparisons (results in 0 or 1).
!= == Comparisons (results in 0 or 1).
& Bitwise AND (0b11 & 0b10 = 0b10).
^ Bitwise XOR (0b110 ^ 0b101 = 0b011).
| Bitwise OR (0b01 | 0b10 = 0b11).
&& Logical AND (results in 0 or 1).
|| Logical OR (results in 0 or 1).
?: Conditional (result=(test expr)?(true expr):(false
expr)).
,; Expression separator.

Functions:
If a function name is not followed by optional whitespace and a
parenthesis '(', it will be interpreted as a variable name.

User-defined functions:
Variables may be defined as functions by including parentheses
and a parameter list in the variable name. The function must be
defined with no spaces between the function name and the first
parenthesis. The variables in the parameter list must match the
variables in the expression. For example:

ConSet /A xRoot(x,y):=x**(1/y), xRoot=xRoot(8, 3)

Multi-statement functions can be defined by enclosing the
statements in braces. Do not terminate the last statement with a
delimiter, it will be the return value. For example:

ConSet /A func(x,y):={x+=1;x**y}, z=func(2, 2)

Built-in functions:
abs(expr) Absolute value.
acos(expr) Arc cosine.
asin(expr) Arc sine.
atan(expr) Arc tangent.
atan2(Yexpr,Xexpr)
Arc tangent of Y/X.
avgRC(expr,var,value[,h])
Average rate of change (forward-difference quotient).
'expr' must be a function of 'var' whose derivative
will be examined at 'value' with a step value of 'h'.
'h' defaults to 0.001.
cdim(var) Column dimension of a list or array.
ceil(expr) Ceiling.
cos(expr) Cosine.
cosh(expr) Hyperbolic cosine.
dim(var) Length of the string contained in 'var'.
dms(expr) Returns 'expr' as three integers concatenated into
the format DMMSS. 'D' may be one or more digits.
exp(expr) Natural e raised to the value of expr.
Also $e**(expr).
find("sub","string"[,offset])
Returns the zero-based position of "sub" in "string"
starting with 'offset', or zero if 'offset' is not
specified. If \"sub\" is not found the function
returns -1. Parameters may be quoted strings or
unquoted variable names. 'offset' need not be quoted.
Negative offsets count forward from end.
findi("sub","string"[,offset])
Same as find() except that text case is
insignificant.
floor(expr) Floor.
fpart(expr) Fractional part.
gamma(expr) Gamma function (implemented as
exp(lng(expr))).
gcd(expr,expr)
Greatest common divisor.
ipart(expr) Integer part.
jd2g(expr) Gregorian date from a chronological JDN, valid
-4900-03-01 G onward. The return value is an integer
in the ISO format YYYYMMDD.
jdnc([y[,m[,d]]])
Julian Day Number- Chronological, valid -4800-03-01 G
onward. With no parameters the current JDN (UT) is
returned.
lcm(expr,expr)
Least common multiple.
ldim(var) Number of lines in a variable..
ln(expr) Natural log.
lng(expr) Gamma log (from Lanzcos. 0>expr>=450).
log(expr) Base 10 log.
ltime() Local time in hours.
mjd([y[,m[,d]]])
Modified Julian Day Number- With no parameters the
current MJD (UT) is returned.
mjdg(expr) Gregorian date from a MJD number. The return value is
an integer in the ISO format YYYYMMDD.
mod(expr,expr)
Modulus (x-y*floor(x/y). See also % operator.
nCr(expr1,expr2)
Number of combinations of expr1, an integer, taken
expr2 at a time.
nDer(expr,var,value[,h]) or nDer(expr,var=value[,h])
Numerical derivative (central-difference quotient).
'expr' must be a function of 'var' whose derivative
will be examined at 'value' with a step value of 'h'.
'h' defaults to 0.001.
nPr(expr1,expr2)
Number of permutations of expr1, an integer, taken
expr2 at a time.

ord(string) ASCII value of the first or indicated character in
'string'. Negative offsets count forward from end.
poly(x,degree,coeffs...)
Value of the polynomial of degree 'degree' at x='x'
with 'degree'+1 coeffs from low to high. Ex: x**3-
2x**2+5x-1 with x=2 is poly(2,3,-1,5,-2,1). See
MathNotes.txt for further example and explanation.
pow(Xexpr,Yexpr)
Power function (X**Y). See also ** operator.
prod(expr,var,low,high)
Product of expr with var from low to high. For
example, 'prod(x,x,1,5)' results in 120 (5!).
rand([max]) A random integer from 0 to 'max' inclusive. 'max'
defaults to 32767.
rdim(var) Row dimension of a array.
round(expr [,int])
Rounds 'expr' to 'int' digits after the decimal.
'int' may be negative for integer rounding; if
omitted it defaults to 12.
seq(expr,var,start,step,stop)
Creates a list. Must be used alone in a comma
delimited expression. For example,
'/A z=seq(x,x,1,1,5)' results in 'z=1 2 3 4 5'.
sign(expr) The sign of the value returned by the expression:
(expr>0, sign()=1; expr<0, sign()=-1; expr=0,
sign=0).
sin(expr) Sine.
sinh(expr) Hyperbolic sine.
sqrt(expr) Square root. Also x**(1/2).
sum(expr,var,low,high)
Sum of expr with var from low to high. For
example, 'sum(x/2+0.5,x,2,4)' results in 6.
tan(expr) Tangent.
tanh(expr) Hyperbolic tangent.
tick() A relative time in ms that the system has been up
(wraps at 49.7 days).
utime() Universal time in hours.

/B
When used with the /A switch, numbers will be output in binary
form. If this switch is followed by a decimal, the fractional part
will also be converted and printed.

Ex: ConSet /AB "bin=1<<31"

/C name=value to append
Concatenate the existing value of 'name' with 'value to
append'. This procedure is normally accomplished as follows:

SET var=%var% more stuff

If 'value to append' is omitted, a newline will be appended to
the variable's contents if it exists. If 'name' is not
previously defined then it will be set with 'value'. No spacing
is added between the concatenated strings. This switch can be
used to append additional elements to a list as follows

ConSet /C VAR= %NewElement%

/D StringToMatch
Delete all variables beginning with 'string'. If 'string' is
omitted, all 'ConSet_' variables will be deleted.

EX: ConSet /D MyVars_

This simplifies the task of cleaning up at the end of a script.
Precede all of your variables with a unique string and use this
switch to delete them all when they are no longer needed. For
example:

SET MyVar_File=%1
SET MyVar_Dir=%2
ConSet /D MyVar_

/E
Perform an additional expansion of strings before setting or
printing.

EX: ConSet /E VAR=%%VAR2%%

This can be used for delayed expansion of variables in a script
or on the command line, and for expansion of variables in
values retrieved from the registry.

/F
When used with the /A switch, numbers will be formatted
according to the user's locale setting unless they are in the
binary, octal or hex bases. Commas, radix, or other separators are
inserted as specified by local settings. If the output base is
octal, this switch will cause the output to be in the traditional
format (0# instead of 0o#).

EX: ConSet /AF VAR=123456789

/H
When used with the /P switch, typed text will not be echoed.

Ex: ConSet /PH Password=What is your password?

/I
When used with the /A switch, numbers will be output as
integers.

Ex: ConSet /AI "int=1.1"

/K var=[\\computer\]hive\subkey\value
Get the value from the specified registry location. Supported
hives are [HKEY_]: CLASSES_ROOT, CURRENT_USER, LOCAL_MACHINE,
USERS, and CURRENT_CONFIG. For remote computers, only the root
hives LOCAL_MACHINE and USERS are supported but the others are
still available as subkeys.

EX: ConSet /K VAR=HKEY_CURRENT_USER\Console\FullScreen

The hive may be specified by the full name (i.e.
HKEY_CLASSES_ROOT), the shortened name as shown above (i.e.
CLASSES_ROOT), or the common 3 or 4 letter abbreviation (HKCR,
HKCU, HKLM, HKU, HKCC). Both upper and lower case are accepted.

/M var[=[value]]
Set or clear the machine (system) variable in the registry.

EX: ConSet: /M /U var=value

These variables are read from the registry when a top level
CMD.EXE is started, such as when opening a new console window.
Changes to these variables do not affect the current or child
processes.

/N StringToMatch
Only the name of the variable(s) will be printed.

EX: ConSet /N



The normal output when listing variables is 'VARNAME=VALUE'.
This switch will cause only VARNAME to be printed.

/O
When used with the /A switch, numbers will be output in octal
form. If this switch is followed by a decimal, the fractional part
will also be converted and printed. If the switch /F is included,
the traditional octal format will be used.

Ex: ConSet /AO oct=100

/P var=prompt
Prompt for input to be stored in the variable. 'prompt' will be
printed as the prompt.

EX: ConSet /P UserName=What is your name?

Displays the specified prompt and waits for input. When RETURN
is entered, input terminates and the string is stored in the
specified variable. Spacing is permitted after the prompt. The /H
switch may be included to disable input echo.

/Q
Disables all error reporting. Use this switch with caution.

Ex: ConSet /QD MyVars_

/S
Set window and buffer parameters into 'ConSet_...' variables.

EX: ConSet /S
EX: ConSet ConSet_Color=0F

Sets the following variables with the indicated value:

ConSet_Title The title of the console window.
ConSet_Color *The text colors. See 'COLOR/?' for format.
ConSet_W_Lines *The number of console window lines.
ConSet_W_Cols *The number of console window columns.
ConSet_B_Lines *The number of console buffer lines.
ConSet_B_Cols *The number of console buffer colunms.
ConSet_Cursor_sz *The size in percentage (0-100) of the
cursor.
ConSet_Cursor_XY *Position of the cursor. Top-left is '0 0'.
ConSet_MaxWin_XY The maximum window size permitable.

If ConSet is used to modify any of the variables that are
marked with an asterisk, ConSet will adjust the console window
to match the value specified. The example above changes the
background color to black and the foreground color to white. The
largest permitable buffer dimensions are 32,767 by 32,767.

/T var[=[value]]
Set or clear the user variable in the registry's volatile
(temporary) environment.

EX: ConSet: /T var=value

These variables are read from the registry when a top level
CMD.EXE is started, such as when opening a new console window.
Changes to these variables do not affect the current or child
processes. This environment is not saved at user logoff.

/U var[=[value]]
Set or clear the user variable in the registry.

EX: ConSet: /M /U var=value

These variables are read from the registry when a top level
CMD.EXE is started, such as when opening a new console window.
Changes to these variables do not affect the current or child
processes.

/V StringToMatch
Only the value of the variable(s) will be printed.

EX: ConSet /V

The normal output when listing variables is 'VARNAME=VALUE'.
This switch will cause only VALUE to be printed.

/X and /X StringToMatch
When used with the /A switch, numbers will be output in hex
form. If this switch is followed by a decimal, the fractional part
will also be converted and printed.

Ex: ConSet /AX "hex=num&0xF0"

When used with a string, only the variable that exactly matches
StringToMatch will be printed or deleted.

EX: ConSet /X VarName
EX: ConSet /DX VarName

Normally all variables whose names match or begin with
StringToMatch will be printed or deleted. This switch permits
printing or deleting only the one variable which matches
exactly.

/CD
Set the current directory into CD.

EX: ConSet /CD

CD is supported as a dynamic variable by Windows 2000 but by
not by Windows NT4. This switch makes getting the current
directory on NT4 almost as easy. The current directory of any
drive that has been accessed by the current instance of CMD.EXE is
also available as the variable %=D:%, where D is the drive letter
of that drive.

/DATE [y+value] [m+value] [d+value]
Set the local date (YYYY-MM-DD) into DATE, the local week number
(S## M##) into WEEK, the local day of year (001-366) into DOY, the
local weekday name into WEEKDAY, and the system (UTC) date (YYYY-
MM-DD) into SYSTEMDATE.

EX: ConSet /DATE

DATE is supported as a dynamic variable by Windows 2000 but not
by Windows NT4. This switch makes getting the current date on
NT4 almost as easy. Most scripting problems require that the
date be in an easily parsed format, and the international
standard used by this program is just that. The WEEK variable
is set with 'S## M##', where S## is the week number with Sunday
as the first day of the week and M## is the week number with
Monday as the first day of the week. WEEKDAY is set with the
weekday name in the local language. With version 1.2 the variable
JULIAN has been replaced by the variable DOY. JULIAN will remain
available for a short transition period.

Addition and subtraction can be performed on the current date
to produce a date relative to it. This does not affect the
system's date. Follow the /DATE switch with the desired math, for
example:

ConSet /DATE y+1 m-13 d+30

/PID=pid#
Make all changes to the process with process identification
number 'pid#'.

EX: ConSet /PID=245

If 'PID#' is specified all changes will be made in the
environment of the specified process instead of in the current
environment. This feature can only be used to write to the
processes environment; all reads will still be from the current
environment. If 'PID#' is not specified, the variable PID will be
set with the PID# of ConSet's parent process.

/RANDOM
Set a random number into RANDOM.

EX: ConSet /RANDOM

RANDOM is supported as a dynamic variable by Windows 2000 but
not by Windows NT4. This switch makes getting a random number
on NT4 almost as easy. This program uses a much better
algorithm than does Windows 2000. You can see the difference if
you call both in a tight loop. The function rand() is available
in the math package.

/TIME
Set the local time (HH:MM:SS.mss) into TIME, the system time
(HH:MM:SS.mss) into SYSTEMTIME, and the time bias ([-]minutes)
into TIMEBIAS.

EX: ConSet /TIME

TIME is supported as a dynamic variable by Windows 2000 but not
by Windows NT4. This switch makes getting the current time on
NT4 almost as easy. The TIMEBIAS variable indicates the difference
in minutes between UTC (system time) and local time (UTC=local
time+TIMEBIAS). The bias is not sdjusted if addition or
subtraction is performed on the TIME variable.

Addition and subtraction can be performed on the current time
to produce a time relative to it. This does not affect the
system's time. If the resulting time carries over to a previous or
following day, the date variables will be set with the applicable
date. Follow the /TIME switch with the desired math, for example:

ConSet /TIME h+1 m-13 s+30


ENVIRONMENT
If the variable %ConSet_prec% is defined with a value, that value
will be used as the precision for floating point numbers.

This program creates, modifies, and deletes environment variables.

REGISTRY
This program does not read configuration information from the registry.

The /M, /U, and /T switches create, modify, or delete values in the
machine or user environment subkeys.

LIMITS
The environment appears to have a limit of about 32 kilobytes.

ERRORLEVEL
The errorlevel set for all errors is 1. An errorlevel of 0 indicates no
error.

CHANGES
Version 1.4
1. Fixes a minor decision error with enumerating registry variables.
2. When the switches /M and /U are used together when listing the PATH
variable, PATH from the machine key and PATH from the user key will
be concatenated as: PATH=[;]. This is the same
behavior as the system. The intervening semicolon is included only
if necessary.

BUGS
Plenty. Report them to .

AUTHOR
Frank P. Westlake .

COPYRIGHT
Copyright ©2001, 2002 by Frank P. Westlake.

ACKNOWLEDGEMENTS
Significant help was provided by Garry Deane whose meticulous
attention to detail proved invaluable in locating many bugs and in
identifying some inconsistencies with SET.

The algorithm for gamma log was retrieved from a calculator program
written for the TI-92 series calculator. The only credit given in
that program for the algorithm is "by Lanzcos".

The Julian Day algorithms in the jdnc() and jd2g() functions were
written by Henry F. Fliegel and Thomas C. Van Flandern.

[Download]


8)

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
Fantastic tool.
Posted Image

pepe
  • Members
  • 4 posts
  • Last active: Apr 18 2009 05:14 PM
  • Joined: 15 Dec 2008
"conset.exe" is specially usefull if you have to deal with BAT files for system administration, because it is a tool you can use to inject the text output of win32 console programs into CMD.EXE variables:

For example:
C:\USR\conset>echo %TEST1%
%TEST1%

C:\USR\conset>conset.exe TEST1=`date /t`

C:\USR\conset>echo %TEST1%
15/12/2008

C:\USR\conset>

I am using it in Windows 2003 x86 and it is JUST GREAT.

However, conset.exe seems not to work with Windows 2003 x64. It gives this error:
C:\USR\conset>conset TEST1=`date /T`

ConSet: Error setting variable

I've tried contacting the conset.exe author, but his email domain seems to no longer exist:

[email protected]
#554 5.4.4 SMTPSEND.DNS.NonExistentDomain; nonexistent domain ##


Does any one know of a version of conset.exe which works on Windows XP/2003 x64?

Or does anyone know of a similar utility to inject the text output from win32 console programs into CMD.EXE variables?

Any help would be much appreciated.

pepe
  • Members
  • 4 posts
  • Last active: Apr 18 2009 05:14 PM
  • Joined: 15 Dec 2008
Well, I reply to myself to share with the community how have I solved my problem.

In order to inject into a CMD.EXE environment variable the output from a Win32 console program, you have to go through some hoops, and you need to use the "for" command:

C:\>echo %hello%
%hello%

C:\>for /f "usebackq" %i in (`time/t`) do (set hello=%i)

C:\>echo %hello%
23:02

C:\>time /t
23:02

C:\>

If the output from the Win32 console program has several lines and/or serveral words in each line and you are only interesting in capturing into your variable one single word among all, you can use the auxiliary programs "grep", "awk", "sed", "tail" and "head" from cygwin package. For example:

C:\>echo %byebye%
%byebye%

C:\>date /t
sun 08-02-2009

C:\>for /f "usebackq" %i in (`date /t`) do (set byebye=%i)

C:\>echo %byebye%
sun

C:\>for /f "usebackq" %i in (`"date /t | c:\usr\cygwin\bin\gawk '{print $2}'"`) do (set byebye=%i)

C:\>echo %byebye%
08-02-2009

C:\>

As you can see above, the output from the command "date /t" (in my Windows configuration) is two words: "sun 08-02-2009", and in the first "for" it only injects the first word ("sun") into the variable "byebye". However, using the auxiliary command "gawk" I can choose to "print" the second word and so it is the word "08-02-2009" which is injected into the "byebye" variable in the second "for".

For more info, install the cygwin package and do "man grep", "man gawk", "man head" and "man tail".

One more example: Suppose I want to put the C: disk label into a variable using a BAT script:

C:\>echo %my_C_label%
%my_C_label%

C:\>dir c:
 El volumen de la unidad C es SISTEMA_NTFS
 El número de serie del volumen es: D498-AAF5

 Directorio de C:\

22-12-2008  21:09       <DIR>          Archivos de programa
22-03-2008  03:17       <DIR>          Documents and Settings
19-11-2006  18:57       <DIR>          export
16-12-2007  21:45       <DIR>          PerfLogs
11-12-2008  22:17       <DIR>          usr
16-01-2009  17:01       <DIR>          WINNT
               0 archivos              0 bytes
               6 dirs   3.644.592.128 bytes libres


C:\>for /f "usebackq" %i in (`"dir c: | c:\usr\cygwin\bin\head -n1 | c:\usr\cygwin\bin\gawk '{print $8}'"`) do (set my_C_label=%i)

C:\>echo %my_C_label%
SISTEMA_NTFS

I hope you find these tips useful.

Best regards,

Pepe.

Gerald
  • Guests
  • Last active:
  • Joined: --
Hi Pepe,

Export.exe is a tool which covers the stdout-into-variable part of conset.exe and is also 64bit-compatible, maybe it helps you:

http://www.xeox.at/i...emid=28&lang=en

Example: Read the current date from stdout and put it into an environment variable

C:\tmp>export.exe DATEVAR=`date /t`
C:\tmp>echo %DATEVAR%
25.02.2009

pepe
  • Members
  • 4 posts
  • Last active: Apr 18 2009 05:14 PM
  • Joined: 15 Dec 2008

Hi Pepe,

Export.exe is a tool which covers the stdout-into-variable part of conset.exe and is also 64bit-compatible, maybe it helps you:

http://www.xeox.at/i...emid=28&lang=en

Thank you, Gerald. I have already downloaded export.exe and I will report back about it.

Looks quite promising so far...

  • Guests
  • Last active:
  • Joined: --
Download Link dead.

Another one:

http://www.geocities...e/nt/index.html

BoBo³
  • Guests
  • Last active:
  • Joined: --
Alternative links:
[Download]
[Description]

... both needs some time to load :roll:

pepe
  • Members
  • 4 posts
  • Last active: Apr 18 2009 05:14 PM
  • Joined: 15 Dec 2008

Hi Pepe,

Export.exe is a tool which covers the stdout-into-variable part of conset.exe and is also 64bit-compatible, maybe it helps you:

http://www.xeox.at/i...emid=28&lang=en

Thank you, Gerald. I have already downloaded export.exe and I will report back about it.

Looks quite promising so far...


Hello, Gerald.

I've been using your "export.exe" tool quite successfully. Thanks a lot for making it and for allowing us all to use it.

However, I have recently found a problem with it. I'll show here how I arrived to this problem (in bold is what I type at a CMD.EXE prompt):

C:\> echo %_My_Test%
echo %_My_Test%

C:\> date /t
28-10-2009

C:\> Export.exe _My_Test=`date /t`
C:\> echo %_My_Test%
28-10-2009

C:\> date /t | c:\USR\cygwin\gawk-3.1.5.exe -F "-" '{print $2}'
10

C:\> Export.exe _My_Test=`date /t | c:\USR\cygwin\gawk-3.1.5.exe -F "-" '{print $2}'`
gawk-3.1.5: {print $2}`
gawk-3.1.5:           ^ invalid char '`' in expression


It seems that "export.exe" is passing the closing "`" sign to the command, or perhaps it is a problem the fact that there is a pipe sign "|" in the middle of the command whose output I want to put into the _My_Test variable...

Is there a workaround for this problem?

Thanks a lot.