Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Search for text in environment variable

50 views
Skip to first unread message

Jack B. Pollack

unread,
May 11, 2013, 6:30:45 PM5/11/13
to
I have a backup program that runs from a Win 98 startup disk (not a DOS box
under Windows).
I need to be able to detect if it is running on Computer1 or Computer2.

Obviously, I cant read or see the NTFS hard drives to determine C1 or C2,
but there are two differences I can detect easily under DOS. A DOS mem
command reports slightly different value, and if I load oakcd.sys the CD
drive make & model numbers are different.

So unless someone has a better (easier) idea, what I would like to do is
send the output of a mem command preferably to a environment variable (would
prefer not to write it to a temp file) and then search for a specific value.

Can someone help mw with this?

Thanks


foxidrive

unread,
May 11, 2013, 11:23:41 PM5/11/13
to
Are you able to put a file in the root of C1?

if exist c:\pc-1.txt set var=yes




--
foxi

foxidrive

unread,
May 12, 2013, 12:24:50 AM5/12/13
to
I missed the NTFS bit - so you can't see the HDD.


mem /c |find "string" >nul
if not errorlevel 1 set var=c1



--
foxi

Frank Westlake

unread,
May 12, 2013, 7:37:43 AM5/12/13
to
2013-05-11 15:30, Jack B. Pollack:
> I have a backup program that runs from a Win 98 startup disk (not a DOS box
> under Windows).
> I need to be able to detect if it is running on Computer1 or Computer2.
>
> Obviously, I cant read or see the NTFS hard drives to determine C1 or C2,
> but there are two differences I can detect easily under DOS. A DOS mem
> command reports slightly different value, and if I load oakcd.sys the CD
> drive make & model numbers are different.
>
> So unless someone has a better (easier) idea ...

It isn't explicitly stated but apparently you are booting from a Windows 98 CD onto computers which have NTFS volumes, so this is a request for help
with scripting COMMAND.COM, not CMD.EXE; is that correct?

Frank

Jack B. Pollack

unread,
May 12, 2013, 10:53:58 AM5/12/13
to

> mem /c |find "string" >nul
> if not errorlevel 1 set var=c1
> --
> foxi

Thanks. Worked perfectly


Stanley Daniel de Liver

unread,
May 13, 2013, 2:16:39 PM5/13/13
to
On Sat, 11 May 2013 23:30:45 +0100, Jack B. Pollack <N...@ne.nothing> wrote:

> I have a backup program that runs from a Win 98 startup disk (not a DOS
> box
> under Windows).
> I need to be able to detect if it is running on Computer1 or Computer2.
>
> Obviously, I cant read or see the NTFS hard drives to determine C1 or C2,
> but there are two differences I can detect easily under DOS. A DOS mem
> command reports slightly different value, and if I load oakcd.sys the CD
> drive make & model numbers are different.
>
> So unless someone has a better (easier) idea, what I would like to do is

No, sorry. When I used to do this I used a small assembler program to scan
for a signature in the ROM to distinguish the PCs, which then allowed me
to choose a NIC. These days I'd use a pciscan to detect it.

> send the output of a mem command preferably to a environment variable
> (would
> prefer not to write it to a temp file) and then search for a specific
> value.
>

> Can someone help mw with this?
>
Looks like foxidrive has the answer

> Thanks
>
>


--
It's a money /life balance.

mokomoji

unread,
Jul 8, 2013, 10:05:30 AM7/8/13
to
2013년 5월 12일 일요일 오전 7시 30분 45초 UTC+9, Jack B. Pollack 님의 말:
> I have a backup program that runs from a Win 98 startup disk (not a DOS box under Windows). I need to be able to detect if it is running on Computer1 or Computer2. Obviously, I cant read or see the NTFS hard drives to determine C1 or C2, but there are two differences I can detect easily under DOS. A DOS mem command reports slightly different value, and if I load oakcd.sys the CD drive make & model numbers are different. So unless someone has a better (easier) idea, what I would like to do is send the output of a mem command preferably to a environment variable (would prefer not to write it to a temp file) and then search for a specific value. Can someone help mw with this? Thanks

hdd volume serial number
english windows
dir |find "Volume Serial Number"
if "Volume Serail Number is xxxxx" == "Volume Serail Number is xxxxx" goto :xxx
if "Volume Serail Number is xxxxx" == "Volume Serail Number is xxxxx" goto :xxx



Stanley Daniel de Liver

unread,
Jul 8, 2013, 11:29:11 AM7/8/13
to
On Mon, 08 Jul 2013 15:05:30 +0100, mokomoji <moko...@naver.com> wrote:

> 2013년 5월 12일 일요일 오전 7시 30분 45초 UTC+9, Jack B. Pollack 님의 말:
>> I have a backup program that runs from a Win 98 startup disk (not a DOS
>> box under Windows). I need to be able to detect if it is running on
>> Computer1 or Computer2. Obviously, I cant read or see the NTFS hard
>> drives to determine C1 or C2, but there are two differences I can
>> detect easily under DOS. A DOS mem command reports slightly different
>> value, and if I load oakcd.sys the CD drive make & model numbers are
>> different. So unless someone has a better (easier) idea, what I would
>> like to do is send the output of a mem command preferably to a
>> environment variable (would prefer not to write it to a temp file) and
>> then search for a specific value. Can someone help mw with this? Thanks

If you re-read the question, he can't access the hard disk info, as it's
NTFS


> hdd volume serial number
> english windows
> dir |find "Volume Serial Number"
> if "Volume Serail Number is xxxxx" == "Volume Serail Number is xxxxx"
> goto :xxx
> if "Volume Serail Number is xxxxx" == "Volume Serail Number is xxxxx"
> goto :xxx
>
this would be closer, if the hard disks could be seen:
for /F "tokens=5 delims= " %%a in ('vol C:^|find "Volume Serial"') do if
%%a == xxxx-yyyy echo Computer1
0 new messages