当我在网络驱动器上运行批处理文件时,我收到“不支持 UNC 路径”错误。
我想将批处理文件的当前目录存储在一个变量中,以便pushd
在当前目录更改为“C:\Windows”之前通过命令切换到它。
对不起,如果我错过了什么!
编辑:
继承人的代码:
@echo off
SETLOCAL EnableExtensions
title School Minecraft Hunger Games Launcher
set appdata=%cd%\core
set usrname=%USERNAME%
:lol
cls
set choice=
echo -------------------------------------------------------------------------------
echo School Minecraft Launcher v4.2
echo Minecraft Version: 1.5.2
echo -------------------------------------------------------------------------------
echo Logging in with the name "%usrname%". Is this correct? (y/n)
set /p choice=
if "%choice%"=="y" goto check
if "%choice%"=="yes" goto check
if "%choice%"=="n" goto argue
if "%choice%"=="no" goto argue
echo.
echo That is not a recognized command, Press enter to try again.
pause > nul
goto lol
:argue
cls
set provide2=
echo To change your ingame username, please provide the override password:
echo.
echo Type "back" to cancel.
echo.
set /p provide2=Password:
if "%provide2%"=="changename" goto enternewname
if "%provide2%"=="back" goto lol
echo.
echo Incorrect Password.
echo.
echo Press enter to try again...
pause > nul
goto argue
:enternewname
cls
echo Please enter new name, then press enter:
set /p usrname=
goto lol
:check
cls
if "%usrname%"=="user1" set knee=watermelon
if "%usrname%"=="user2" set knee=computer
if "%usrname%"=="user3" set knee=fish
if "%usrname%"=="user4" set knee=kittens
:final
if "%knee%"=="" goto rungame
cls
set provide=
echo -------------------------------------------------------------------------------
echo School Minecraft Launcher v4a
echo Minecraft Version: 1.5.2
echo -------------------------------------------------------------------------------
echo You are trying to login as an admin. Please provide your password.
echo.
echo Username: %usrname%
set /p provide=Password:
if "%knee%"=="%provide%" goto rungame
echo.
echo Incorrect password.
echo.
echo Press enter to exit...
pause > nul
exit
:rungame
pushd "%appdata%\.minecraft\bin"
start javaw -cp minecraft.jar;lwjgl.jar;lwjgl_util.jar -Djava.library.path="natives" net.minecraft.client.Minecraft "%usrname%"
exit
它应该在您放置它的任何地方运行,只要您包含一个名为“core”的文件夹,其中包含游戏文件。通常它会是:%cd%\core
。如果您向下看代码的底部,您会看到它需要将目录更改为:%cd%\core\.minecraft\bin
开始游戏...但是没有当前目录变量,我不能这样做。