Mode command does not recognize device

November 30, 2010 at 18:54:52
Specs: Windows XP SP3, Core i7 920 2.67 GHz 2.7 GB RAM
I'm running (pseudo) DOS under Windows XP. I use the "mode" command, which lists a bunch of devices that DOS can see. One of these is named "LNK00" and is a device that I want to change some settings on. However when I try to use "mode LNK00" I get the error

Invalid parameter - LNK00

But, mode has just told me a device with this name exists! I do not get this error when trying to alter settings on various COM ports. I don't know why mode can list this device but then not refer to it directly.

If it helps, this device is some sort of virtual port that has been set up to allow communication with a frame grabber that is plugged into a PCI slot. There is a corresponding listing for COM23 in device manager, but COM23 does not show up using a variety of applications (using "mode" in DOS; using Matlab instrument control toolbox; using the software that came with the frame grabber/camera). These all instead refer to "LNK00".

I am having a really hard time sending commands to this thing. HyperTerminal is able to do it without any problems, but I need something that can be automated (C code that emulates HyperTerminal would be fine), hence why I am attempting to resort to DOS.

Apologies if this is in the wrong forum and belongs under Win XP. Thanks for any clues guys!


See More: Mode command does not recognize device

Report •

#1
December 1, 2010 at 08:58:31
I can't help about mode's behavior, but if you need something like HyperTerminal that can be driven by scripting, PUTTY may do the job.

PUTTY (Google for that) is an Open Source package that allows command line input and is scriptable to be fully automated. It replaces HyperTerminal in Vista since Microsoft stopped to deliver a built-in terminal tool.

I never used it, but people report it is very effective.


Report •

#2
December 1, 2010 at 17:20:34
PUTTY does look useful, thanks. I have found a work-around which will do for now though by cobbling together some C code that will input text for me into HyperTerminal. And I do mean cobbled, since I know nothing about C. Snippet as followed for anyone interested (works for other programs too, e.g. notepad/web browser - sorry about lack of indentation, it won't let me do it):

#include <windows.h>

int main(char* windowNameBuf, int x, int y,char* textToTypeBuf)

{

POINT coordsInTheEditField;
coordsInTheEditField.x = x;
coordsInTheEditField.y = y;

int buflen = strlen(textToTypeBuf);

HWND hwnd = FindWindow(NULL,TEXT(windowNameBuf));

if (hwnd != 0)

for(int i = 0; i < buflen; i++)

SendMessage(ChildWindowFromPoint(hwnd,coordsInTheEditField),
WM_CHAR,textToTypeBuf[i],NULL);

return 0;

}

First argument to main is the name of the window as it appears eg in the taskbar, for example "Untitled - Notepad". Second and third arguments are x/y co-ordinates that lie anywhere within the text field that you want to "type" into, relative to the window. If you are having trouble just take a screenshot and use MSPaint to find the co-ordinates. Last argument is the text you want to inject. May have to apply some format conversions if you want newline/carriage return etc.


Report •

#3
December 2, 2010 at 00:39:39
Very interesting pab83, but not many programmers read this forum, they hang out in the PROGRAMMING FORUM.

This forum is aimed at 'MS-DOS6 and compatable' not the Windows NT Family which has no DOS whatsoever......


Report •

Related Solutions

#4
December 2, 2010 at 14:21:50
Thank you for the advice X86, I suppose I will leave it up to some FORUM MODERATOR to move to the right place :S

I replied to this thread with the solution that I'd found because most people Google around when they have these kinds of problems, so it's best to just keep it all in the one place.

I'd like to keep it in the DOS forum though until it picks up an answer to the DOS question.


Report •

#5
December 3, 2010 at 11:46:27
There is no MS-DOS question asked, you are asking about NT Command Prompt in Windows XP which IS NOT MS-DOS but a NTVDM !

Report •

#6
December 3, 2010 at 15:20:16
Is there a mode command in DOS?
Would it give the same response in this instance as the mode command in pseudo-DOS?

If the answers are yes, the question is relevant here. If you don't have any answers, you are not relevant here. Either way, it's really up to a forum mod to decide.


Report •

#7
December 4, 2010 at 01:20:23
yes of course the MODE Command is in MS-DOS, but the syntax in MS-DOS and NT Command Prompt can be quite different in the end results.

Windows NT Family has NTVDM (New Technology Virtual Dos Machine), what you call Pseudo-DOS is actually NT Command Prompt.

CMD.EXE = NT Command Prompt
COMMAND.COM = NTVDM

NT Command Prompt is more widely used these days hence why I stae that this is more applicable to the Programming Forum, where it would reach a wider audience, of cours the Moderators will not move it and have been reluctant to for the past 10+ years.

Forums are for sharing and if in a forum section most Batch Programmers will not look it is pointless posting and answering there IMO..............


Report •

#8
December 5, 2010 at 14:30:21
Oh well, if the moderators won't move it I'm sure they have a reason. At any rate, I trust in the power of Google to ensure that this knowledge reaches the ears of future problem-havers.

Report •

Ask Question