A programming beginner here so I am working on a simple program that uses the user's input to name a text file and then the program stores the ipconfig /all information in that text file. I receive an error "unrecognized or incomplete command line." I understand it's quite easy to write the ipconfig /all to a text file using the command prompt but I was hoping to get it working using C.
Thank you!
#include<stdlib.h>
#define MAX_LEN 20
int main()
{
char myfile[MAX_LEN];
printf ("Enter text file name: ");
scanf ("%s", myfile);
system("C:\\Windows\\System32\\ipconfig /all 2>&1 \\Location\myfile.txt");
return 0;
}
Copyright Notice:Content Author:「Chess Man」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/51287190/ipconfig-all-using-c-programming-leads-to-incomplete-command-line-error