Batch file 我的批处理文件是否与所有计算机兼容?

Batch file 我的批处理文件是否与所有计算机兼容?,batch-file,Batch File,这在Windows 8上是否有效并且始终有效?我已经在Windows7上测试过了,但我不确定。。。我让一个朋友测试了它,他说它找不到正确的路径,但我检查了一下,命令的语法是相同的,我不知道为什么会出现问题。假设%USERPROFILE%\Documents\My Games\Terraria\Player和%USERPROFILE%\Google Drive已经存在 @echo off echo Administrative permissions required. Detecting per

这在Windows 8上是否有效并且始终有效?我已经在Windows7上测试过了,但我不确定。。。我让一个朋友测试了它,他说它找不到正确的路径,但我检查了一下,命令的语法是相同的,我不知道为什么会出现问题。假设%USERPROFILE%\Documents\My Games\Terraria\Player和%USERPROFILE%\Google Drive已经存在

@echo off
echo Administrative permissions required. Detecting permissions...

net session >nul 2>&1
if %errorLevel% == 0 (
echo Success: Administrative permissions confirmed.
) else (
echo Failure: Current permissions inadequate. Please run as administatior.
pause >nul
exit
)

echo ---------------------------------------------
echo Below enter "S" for simple install type or "A" for avanced install type.
echo (Simple is recommended, only use advanced if you know what your doing!)
echo ---------------------------------------------

set /p option=Enter:
if /i "%option%"=="S" goto simple
if /i "%option%"=="A" goto advanced


echo Your entry did not match available options. Try again.
pause >nul
exit 

:simple
mklink /d "%USERPROFILE%\Google Drive\Terraria" "%USERPROFILE%\Documents\My Games\Terraria\Players"

cd %USERPROFILE%\Google Drive\Terraria\
copy /y NUL marker >nul
cd %USERPROFILE%\Documents\My Games\Terraria\Players

if exist marker (
    echo Validation of installation complete. Symbolic link functional.
    del marker
) else (
    echo SOMETHING WENT WRONG!!!!!!!!
)

echo ==============
echo You Selected Simple.  & echo.If there are no errors above, your installation should be complete.
echo ==============
pause >nul
exit

:advanced
mkdir "%USERPROFILE%\Google Drive\Terraria"
mklink /d "%USERPROFILE%\Google Drive\Terraria\Players" "%USERPROFILE%\Documents\My Games\Terraria\Players"

cd %USERPROFILE%\Google Drive\Terraria\Players 
copy /y NUL marker >nul
cd %USERPROFILE%\Documents\My Games\Terraria\Players

if exist marker (
    echo Validation of installation complete. Symbolic link functional.
    del marker >nul
) else (
    echo SOMETHING WENT WRONG!!!!!!!!
)

echo ==============
echo You Selected Advanced.  & echo.If there are no errors above, your installation should be complete.
echo ==============
pause >nul
exit

如果已交付,则所有路径都存在


Vista中引入了mklink命令,因此该脚本无法在XP/2003上运行。

是否假定%USERPROFILE%\Google Drive\Terraria已经存在?是,尽管他的错误是无法找到指定的路径。。。