0

Background

I am trying to move .minecraft's folders to the Windows roaming folder. Afterwards, I want to return it to its original position. (My goal is a profile system to switch saves / players)

I don't understand what I am doing incorrectly - perhaps the %CD% variable is incompatible with the move command? the error I get is "The syntax of the error is incorrect"

Code

    @echo off
title .Minecraft switcher
echo welcome !
PING 1.1.1.1 -n 1 -w 1000 >NUL
md .minecrafts
cd %CD%/.minecrafts 
md temp
cd %CD%\..
:3
cls
echo enter 1 to switch .minecrafts
echo enter 2 to create new subdir
set /p "In=:"
if %In%==1 goto :1
if %In%==2 goto :2
if %In%==3 goto :4
if %In%==5 goto :5
goto :3
:1
cls
echo enter folder name
echo folder list...
cd %CD%\.minecrafts
dir /b
set /p "d=:"
MOVE %appdata%\.minecraft %CD%\temp
MOVE %CD%\%d%\.minecraft %appdata%
pause
MOVE %appdata%\.minecraft %CD%\%d%
MOVE %CD%\temp\.minecraft %appdata%
pause
goto :3

:2
cls
echo set folder name
set /p "name=:"
cd %CD%\.minecrafts 
md %name%
cd %CD%\..
pause
goto :3
:4
exit
Fyrn
  • 116
  • 1
  • 8

1 Answers1

0

%cd% ist the current directory. It always changes if you change the directory.

C:\Users\syss>echo %cd%
C:\Users\syss

C:\Users\syss>cd ..

C:\Users>echo %cd%
C:\Users

C:\Users>

as you can see, you dont need to write %cd% on every cd command.

If you want the directory from which the batchfile is called:

set workingdir=%~dp0

and then use %workingdir% instead of %cd%

also be sure that you use the Windows slash '\' and not the standard slash '/' (see line6)

syss
  • 232
  • 8
  • 18