Telnet with a Windows 2003 server

Kenneth Brody kenbrody at bestweb.net
Thu Nov 29 06:28:44 PST 2007


Quoting Bob Rasmussen (Wed, 28 Nov 2007 13:59:22 -0800 (PST)):
[...]
> It would also be possible to write a small program that would output the
> session id, where it could be redirected to a file. Or, what's the best
> way to have an EXE get something into an environment variable, such that
> it will not be lost when the EXE ends? Does Windows have the equivalent of
> "." or reading input from a program, such as
>    set SESSION `someprog.exe'
> ???

Well, now that Windows has real memory protection (as opposed to the old
MS-DOS days), you can no longer do things like change your parent's
environment.

 From a batch file, you can call another batch file with "call batchname".
This will run the other batch file in the same command shell.  Anything
done there, such as setting environment variables, will "stick".

The following will set the variable "var" to the last line in a text
file:

     for /f "delims=" %i in (filename) do set var=%i

Don't forget to double the percent signs if this is in a batch file:

     for /f "delims=" %%i in (filename) do set var=%%i

In a batch file, the following will set "var" to the entire contents of
a file, _if_ the command shell was started with the "/v" flag.  However,
it will have a space at the beginning, and newlines will be replaced by
spaces:

     set var=
     for /f "delims=" %%i in (filename) do set var=!var! %%i

You can test if the shell was started with "/v" using something like this:

===============
@echo off

set list=
for %%f in (a b) do set list=!list! %%f
set list

if "%list%" == "!list! b" echo Sorry, /v not set & goto done
echo Yes, /v appears to be set

:done
===============

> If a variable could be defined, then something called by PFPOSTPRINT could
> dereference that variable, and build an accurate printer name.
>
> Help me brainstorm here.

-- 
KenBrody at BestWeb dot net        spamtrap: <g8ymh8uf001 at sneakemail.com>
http://www.hvcomputer.com
http://www.fileProPlus.com


More information about the Filepro-list mailing list