3

I need to make a .bat file for many people that would be placed in a specific folder and then move specific files from said folder to another folder above the current working directory.

I don't have the paths of where they have said folders, I need to use relative commands.

I know how to move files to lower directories, but don't know how to move them to higher ones.

Here's what I managed (no skills needed, I know) to do that moves files to lower directories.

mkdir "Oudated-do-not-move"
move ThaLuru.shader %cd%/"Oudated-do-not-move"
move DeLin.shader  %cd%/"Oudated-do-not-move"

the list of "move..." lines is way larger but not needed here.

However, I do not know how to make the folder above current folder. At all.

For a test, after making the folder manually, I tried the following option to move file: move DeLin.shader ../"Oudated-do-not-move" - it works.

But I do not know how to make the folder with batch file instead of manually.

I tried these:

mkdir ../test
mkdir %cd%/../test
mkdir %cd%/test

1 Answers1

10

Your problem is in using / (forward slash) instead of \ (back slash)

For DOS directories should all be separated by \ and for me the following works:

mkdir ..\test

There are some places where / is accepted and works, which can make it seem like it should work everywhere, but the "standard" should be \ in most places.

From Why does Windows use backslashes for paths and Unix forward slashes? (emphasis mine)

/ it is recognized by most programmer-level APIs (in all versions of DOS and Windows). So you can often, but not always get away with using / as a directory separator under Windows. A notable exception is that you can't use / as a separator after the \\? prefix which (even in Windows 7) is the only way to specify a path using Unicode or containing more than 260 characters.

Mokubai
  • 95,412