简体   繁体   English

批处理文件Windows 10将不会执行

[英]Batch File Windows 10 won't execute

I am new to batch files. 我是批处理文件的新手。 My Professor has written custom software for Autodesk Maya and the program works on most student's computers; 我的教授为Autodesk Maya编写了定制软件,该程序适用于大多数学生的计算机; however, not on mine. 然而,不是我的。 We all have windows 10 and my computer is brand new. 我们都有Windows 10,我的电脑是全新的。 The .bat simply open and closes. .bat只需打开和关闭。 I add 'Pause' to the last line to see the window stay open and see 'access is denied'; 我将“暂停”添加到最后一行,看到窗口保持打开状态并看到“访问被拒绝”; or, when I run as an administrator, it does nothing. 或者,当我以管理员身份运行时,它什么都不做。 This is confusing as the .bat file is only updating the directory of the plugin. 这很令人困惑,因为.bat文件只更新插件的目录。 I know there are a plethora of reasons for this, but I would appreciate a heads up. 我知道这有很多原因,但我会很感激。 Thank you. 谢谢。

@echo off

set CURR_DIR=%~dp0
set BDMOVE_MOD_FILE=%CURR_DIR%\BDMove.mod
set MAYA_ENV_FILE=%CURR_DIR%\Maya.env

echo + BDMove VERSION %CURR_DIR% > %BDMOVE_MOD_FILE%

echo ^# BDMove Environment Variables > %MAYA_ENV_FILE%
echo. >> %MAYA_ENV_FILE%

echo # Change the following line to reflect your installation >> %MAYA_ENV_FILE%
echo BDMOVE_PATH=%CURR_DIR% >> %MAYA_ENV_FILE%

echo. >> %MAYA_ENV_FILE%
echo MAYA_MODULE_PATH=%%MAYA_MODULE_PATH%%;%%BDMOVE_PATH%% >> %MAYA_ENV_FILE%
echo MAYA_SHELF_PATH=%%MAYA_SHELF_PATH%%;%%BDMOVE_PATH%%\shelves >> %MAYA_ENV_FILE%
echo PATH=%%PATH%%;%%BDMOVE_PATH%%\bin >> %MAYA_ENV_FILE%
Pause

I had the same problem In my case, the folder containing the cmd file and the output log was copied from another computer. 我有同样的问题在我的情况下,包含cmd文件和输出日志的文件夹是从另一台计算机复制的。 The output log file had to be deleted first in order to run the command (even if is recreated/overwritten each time I run the cmd and even if it was on Desktop). 必须首先删除输出日志文件才能运行命令(即使每次运行cmd时都重新创建/覆盖它,即使它在桌面上也是如此)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM