-1

I am learning about batch programming and I have got problem.

I want make a program which places the output of the dir command to file.txt.

What am I doing wrong?

ECHO OFF DIR > file.txt
John Willemse
  • 6,608
  • 7
  • 31
  • 45
user3164700
  • 73
  • 1
  • 2
  • 7

2 Answers2

1

Right now, you are writing "OFF DIR" into to textfile:

ECHO OFF DIR > FILE.TXT

You need to place these commands on two separate lines:

@ECHO OFF
DIR > FILE.TXT

The @ sign before ECHO OFF will hide that command from showing.

John Willemse
  • 6,608
  • 7
  • 31
  • 45
0

I suppose "the problem" is in ECHO OFF

try this

DIR > file.txt
Anton Semenov
  • 6,227
  • 5
  • 41
  • 69