Search code examples
batch-filexcopy

Why does usage of XCOPY for copying *.txt files makes them empty?


I use this batch script while I program in Java to avoid cluttering my folders with class files. But for some reason it can't copy *.txt files.

This is a *.txt file content before copying it to another folder:

U 450
I 100
I 5000
U 500

The batch file contains:

@echo off
set TEST=%1
mkdir %TEST%Folder
xcopy *.txt %TEST%Folder
xcopy %TEST%.java %TEST%Folder
cd %TEST%Folder
javac -encoding utf8 %TEST%.java
java %TEST%
cd..
::RD /S /Q %TEST%Folder //is commented out while I'm debugging 

And this is content of copied file:

 

It is empty.

The strange thing is, if I run xcopy *.txt DestinationFolder on its own, it works just fine.


edit: The %1 variable is the name of the java that the program will compile, all my paths are set up correctly and this part of the code works just fine, the only problematic part is the xcopy


Solution

  • Reinstall windows, will fix all the problems