Ipconfig /all using C programming leads to incomplete command line error
NickName:Chess Man Ask DateTime:2018-07-11T21:48:18

Ipconfig /all using C programming leads to incomplete command line error

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

More about “Ipconfig /all using C programming leads to incomplete command line error” related questions

Ipconfig /all using C programming leads to incomplete command line error

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...

Show Detail

If else batch command with ipconfig

I'm having trouble with using an if else statement in a batch command. I'm running Windows XP. I wrote a simple batch file to output my ip address which works fine. However, I would like to include...

Show Detail

Get just an IP address only from `ipconfig` using native windows command

Let say this is an output of Windows ipconfig command. c:\&gt;ipconfig Windows IP Configuration Wireless LAN adapter Wireless Network Connection: Connection-specific DNS Suffix . : IPv4

Show Detail

Shell script to get IPV4 address dynamically and add to route table using cygwin console for windows

I am writing a shell script which runs on cygwin console for windows, my scritp looks like this #!/usr/bin/bash cmd /c start /d "C:\cygwin\bin" ipconfig | findstr /R /C:"IPv4 Address" ipconfig #to

Show Detail

Linux ipconfig command

I am a new user of Linux and have freshly installed RHEL5 operating system on 1 of my system. I have chosen DHCP during installation. Now after installation when I tried to run ipconfig command on...

Show Detail

Redirect output of a command to a text file in Haxe

I am trying to execute the following code in Haxe. class File_Operations { public static function main() { Sys.command("ipconfig",["&gt;","C:\\Users\\ila5\\Desktop\\Temp.txt"]);&#x

Show Detail

Winzip command line in c programming

I wanted to unzip the file using winzip command line using c programming and i have written the following code but after executing it is showing that the system command couldn't identify internal or

Show Detail

Finding IP in command line

Is it possible to find only the connected IP address of my device in command line by leaving the other adapters. I have used ipconfig, ipconfig /all but it displays all the adapters with the media ...

Show Detail

compiler error - dereferencing pointer to incomplete type In C programming

Can you explain this error for me? In my A.h file: struct TreeNode; struct TreeHead; typedef struct TreeNode * Node; typedef struct TreeHead * Head; In my A.c file: struct TreeNode { char*

Show Detail

Remote ipconfig /release issue with powershell

I have a powershell script that does an ipconfig /release and /flushdns then a shutdown command for my VMs. I do this before creating a snapshot. The script works but it doesn't work for multiple

Show Detail