How to run the windows dir command on current directory in C

1 Answer

0 votes
#include <stdio.h>
#include <stdlib.h>

int main () {
   system("dir");

   return(0);
}




/*
run:

 Volume in drive C has no label.
 Volume Serial Number is A0DA-31AC-8F11-11DA

 Directory of C:\test\main

12/22/2021  09:55 AM    <DIR>          .
12/22/2021  09:55 AM    <DIR>          ..
07/20/2021  05:43 PM    <DIR>          bin
12/22/2021  09:55 AM               763 main.c
07/20/2021  05:43 PM               998 main.cbp
12/22/2021  09:48 AM                98 main.depend
12/22/2021  09:28 AM               356 main.layout
07/20/2021  05:43 PM    <DIR>          obj
               4 File(s)          2,215 bytes
               4 Dir(s)  733,406,474,240 bytes free

Process returned 0 (0x0)   execution time : 0.023 s

*/

 



answered Dec 22, 2021 by avibootz

Related questions

1 answer 268 views
1 answer 141 views
141 views asked May 9, 2023 by avibootz
1 answer 258 views
2 answers 286 views
1 answer 224 views
...