A query regarding a BAT file

Discussion in 'C' started by vikky1988i, Jul 28, 2011.

  1. vikky1988i

    vikky1988i New Member

    Joined:
    Apr 1, 2010
    Messages:
    25
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Mainframes Admin. @ I | Nautix Technologies
    Location:
    chennai , Tamil Nadu ,INDIA
    Hi,

    How can i execute a .BAT file using my C program..

    When i try to execute using SYSTEM() , it's giving me "EXTENDED ERROR 183"
    is there any special way to execute .BAT files?? let me know soon. :pleased:
    Please help me out... thanks in advance...
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    The system() call only launches executables, and bat files aren't executable. Executable files end ONLY with .exe or .com. The executable for batch files is the command prompt, so you'll need something like system("cmd.exe -z myfile.bat"); - replace -z with whatever flag is needed to make cmd.exe run a batch file then exit.
     
  3. vikky1988i

    vikky1988i New Member

    Joined:
    Apr 1, 2010
    Messages:
    25
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Mainframes Admin. @ I | Nautix Technologies
    Location:
    chennai , Tamil Nadu ,INDIA
    thanks for ur help......

    i got it
    :)

    Hw can we return any values to this Batch files from any other programs.. eg: from C hw can we retrun

    i got a idea that we can store somevalues from any program in a txt file and make the batch file to read it.. but without this is there any way???



    Thanks in advance....
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    Google "man system". man is a Unix command short for "manual".
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice