Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mayabatch_Xcopy_motionbuilder_OneTimeline.bat
::"C:\Program Files\Autodesk\Maya2017\bin\mayapy.exe" "C:\temp\hello.py"
::"C:\Program Files\Autodesk\Maya2016\bin\mayapy.exe" -c "import sys;print sys.argv" test 1234 %date%
::['-c', 'test', '1234', '2016/11/08']
:: Dドライブへ移動する
cd /d d:
:: batファイルで、そのファイル自身のパスを取得するしそのディレクトリをカレントディレクトリに。
cd /d %~dp0
::【cmd】カレントディレクトリの「フォルダ名」を取得する
:: echo onになっていると、結果だけでなく実行されるコマンド文字列がそのまま表示されます
::@echo off
@echo on
:: 実行中に値を変化させたい場合
setlocal ENABLEDELAYEDEXPANSION
::------------------------------------------------------
set BatchFileDirPath=%~dp0
echo %BatchFileDirPath%
::バッチファイル内で、カレントディレクトリのフルパスではなく自分のいるディレクトリ名(フォルダ名)だけを取得http://fpcu.on.coocan.jp/dosvcmd/bbs/log/dir/3-0481.html
for %%I in (.) do set DIRNAME=%%~nI%%~xI
echo %DIRNAME%
::cd ../
cd /d ../
echo %DIRNAME%
set CopyDirName=%DIRNAME%
echo %CopyDirName%
set PastDir=_auto
echo %PastDir%
set ParentDir=%CD%
echo %ParentDir%
set CopyPath=%ParentDir%\%CopyDirName%
echo %CopyPath%
set PastPath=%ParentDir%\%CopyDirName%%PastDir%
echo %PastPath%
::cd %CopyPath%
xcopy %CopyPath% %PastPath% /D /S /Y /I
::コピー先をカレントに
cd /d %PastPath%
set MayaWorkspace=%CD%
echo %MayaWorkspace%
set EscapedMayaWorkspace=%MayaWorkspace%
:: 置換
set old=:\
set new=////
call set EscapedMayaWorkspace=%%EscapedMayaWorkspace:%old%=%new%%%
set old=\
set new=/
call set EscapedMayaWorkspace=%%EscapedMayaWorkspace:%old%=%new%%%
echo %EscapedMayaWorkspace%
cd /d c:
set MayaExeBinPath=C:\Program Files\Autodesk\Maya2016\bin\
cd /d %MayaExeBinPath%
set PythonCode=import maya.cmds as cmd;
set PythonCode=%PythonCode%import python.MotionMerge.p015Reference_importReference.Mayabatch_motionbuilderFBX_To_oneTimeLine_Enemy as Mayabatch_motionbuilderFBX_To_oneTimeLine_Enemy;
set PythonCode=%PythonCode%Mayabatch_motionbuilderFBX_To_oneTimeLine_Enemy.Mayabatch_motionbuilderFBX_To_oneTimeLine_Enemy('%EscapedMayaWorkspace%');
set PythonCode=%PythonCode%print('mayabatchExeCommandEnd')
mayabatch.exe -command "python(\"%PythonCode%\")"
::閉じな
cmd /k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.