1
I have tried using some tools to get hardware information on DOS, but they did not have the source code for free use. I need a code solution that returns the serial number or ID in the MS-DOS environment.
1
I have tried using some tools to get hardware information on DOS, but they did not have the source code for free use. I need a code solution that returns the serial number or ID in the MS-DOS environment.
1
You can do dir
and pick up the output
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// O prefixo do `dir` que identifica o serial number
#define SNPREFIX " Volume Serial Number is "
// MUDAR AQUI ----^^^^^^^^^^^^^^^^^^^^^^^^^
int main(void) {
char line[512];
FILE *process;
process = popen("cmd /c dir c:", "r");
// MUDAR AQUI --------------^
while (fgets(line, sizeof line, process)) {
line[strlen(line) - 1] = 0; // clear ENTER
if (strncmp(line, SNPREFIX, strlen(SNPREFIX)) == 0) {
printf("==> %s <==\n", line + strlen(SNPREFIX));
}
}
return 0;
}
Output on my machine (in your case you have to change the "c:" to the letter associated with the pen drive)
==> 8662-7ACB <==
0
I understand what you’re looking for is this:
wmic diskdrive get PNPDeviceID
Or:
wmic diskdrive get SerialNumber
Source: https://superuser.com/questions/600394/get-usb-key-manufacturer-serial-number
WMIC came with windows 2000 if I’m not mistaken. DOS 7.1 is from the 95 season, at most 98.
Browser other questions tagged c c++ assembly ms-of
You are not signed in. Login or sign up in order to post.
I am using MS-DOS 7.10 and DJGPP as compiler.
– Lucas Savioli