Pablo Fabrizio
Pablo Fabrizio

Reputation: 17

How can I create or change a text file within a subdirectory in Cmd?

Just need a little help with cmd if possible. I'm trying to save a set of variables in a subdirectory. I've managed to create a subdirectory and a file containing the saved variables inside the parent folder, but I can't for the life of me figure out how to move the save file into the subdirectory. This is an example of the code I'm using to save variables and create the folder:

(
md Saves
echo %variable1%
echo %variable2%
echo %variable3%
) >variables.save

How can I make it so the 'variables.save' file is put into the 'Saves' folder? Thanks in advance.

Upvotes: 0

Views: 47

Answers (1)

Mofi
Mofi

Reputation: 49097

First, create the subfolder and then echo the variables into the text file in the subfolder.

md Saves >nul
(
    echo %variable1%
    echo %variable2%
    echo %variable3%
) >Saves\variables.save

Upvotes: 1

Related Questions