Can you use a path with a wildcard in SET PATH=%PATH% - batch-file

I have a batch file currently which sets the path for Blender 2.91 then changes the directory so that blender can launch, open a desired .blend file and run a python script. This currently works:
SET PATH=%PATH%;"C:\Program Files\Blender Foundation\Blender 2.91"
N:
cd ""N:\R^&D\Product_Design\CAD_Drawings\Renders\Render Templates\Creo Direct Integration""
blender -b Creo_Import.blend --background --python Creo_Import.py
I want this to run for future releases of blender ie. Blender 3.00 so would like to use a wildcard in the path. I have tried this but it does not work:
SET PATH=%PATH%;"C:\Program Files\Blender Foundation\Blender*"
N:
cd ""N:\R^&D\Product_Design\CAD_Drawings\Renders\Render Templates\Creo Direct Integration""
blender -b Creo_Import.blend --background --python Creo_Import.py
The error message is "'blender' is not recognized as an internal or external command, operable program or batch file."
However if I run:
cd "C:\Program Files\Blender Foundation\Blender*"
blender -b Creo_Import.blend --background --python Creo_Import.py
Blender will launch with no issues, but the .blend and .py file can not be found as the directory is incorrect. Any help will be greatly appreciated.

Related

WinRar compressing with Batch

I would like to use batch and winrar to compress certain files and save them as .scs.
The whole thing just doesn't want to work at the end.
Manually see it from the settings:
The batch code looks like this:
rar a -m0 -ep -u -x "finkenwerder.scs" def map material**.
It almost fits the file size, but when I let the file run in the game, it tells me it doesn't work.
If I complete it manually, the file will work.
I am unsure of whether you need to actually include the folders to the archive or not, so here are 2 solutions. Firstly -x switch is not needed as you are not excluding files.
If you need to include the folders, then use this method. Also please include the full paths to your directories instead as it ensure you do not have issues with paths.
rar a -m0 -u "C:\path\to\file\finkenwerder.scs" "C:\game\def" "C:\game\map" "C:\game\material"
if you need only the files, and not the directories map def and material then do this
rar a -m0 -ep -u "C:\path\to\file\finkenwerder.scs" "C:\game\def" "C:\game\map" "C:\game\material"
lastly, you can also run the switches via batch, but using the GUI WinRAR using the same method as above.
"C:\Program Files\WinRAR\winrar" a -m0 -u "C:\path\to\file\finkenwerder.scs" "C:\game\def" "C:\game\map" "C:\game\material"
or
"C:\Program Files\WinRAR\WinRAR" a -m0 -ep -u "C:\path\to\file\finkenwerder.scs" "C:\game\def" "C:\game\map" "C:\game\material"

TortoiseSvn - Automatically update multiple external properties

I'm currently working on tortoise svn. In order to be able to automatically tag trunk projects so i need to focus on the external properties. As well i would like to edit them automatically using a batch file.
Until now what i've done is:
Getting the last version of the folder which is pointed by the
external property (in order to be able to tag a specific version and
not the head one)
Edit the external property using command line
My batch file looks like this :
::GETTING THE LAST VERSION NUMBER OF THE SOURCE DIRECTORY
svnversion -c %SRC_PATH_WC% | sed -e 's/[MS]//g' -e 's/^[[:digit:]]*://'>temp.txt
set /p VERSION=<temp.txt
del temp.txt
echo %VERSION%
pause
::CREATING THE SVN:EXTERNAL WITH THE VERSION CHOOSEN
svn propset svn:externals "%DIRECTORY_NAME% -r%VERSION% %SVN_SRC_PATH%" .
pause
Now I would like to be able to set multiple external properties. I think i can't by using the svn propset command but i have no clue on what other command to use and how to use it.
Thank you in advance for your help
I've found my answer on another site.
Here is what i've used :
::CREATE FILE AND WRITE THE SVN:EXTERNALS PROPERTIES
echo %DIRECTORY_NAME1% -r%VERSION1% %SVN_SRC_PATH1% > svn_externals
echo %DIRECTORY_NAME2% -r%VERSION2% %SVN_SRC_PATH2% >> svn_externals
::CREATING THE SVN:EXTERNAL WITH THE VERSION CHOOSEN
svn propset svn:externals -F svn_externals .

execute command inside cmd application with one command

I installed Linphone application
http://www.linphone.org/technical-corner/linphone/documentation
I am running this application via cmd executing this command
"C:\Program Files (x86)\Linphone\bin\linphonec.exe"
then I make the call through this command
call number#x.x.x.x
I want to join the tow commands in one line so the cmd start the linphone then execute the call command inside the linphone
Output with & operator
C:\Users\Desktop\1>CD "C:\Program Files (x86)\Linphone\bin\"
C:\Program Files (x86)\Linphone\bin>linphonec.exe & call number#x.x.x.x
WARNING: no real random source present!
Ready
Warning: video is disabled in linphonec, use -V or -C or -D to enable.
linphonec>
how i can do that in cmd ?
CD C:\Program Files (x86)\Linphone\bin\
echo call number#x.x.x.x|linphonec.exe
may work.

Split to volumes using batch

I am using the following command in a batch file in order to archive MY_LARGE_FOLDER and my .rar file is too big:
WinRAR a -r D:\MY_LARGE_FOLDER.rar D:\MY_LARGE_FOLDER\*.txt D:\MY_LARGE_FOLDER\
How can I archive MY_LARGE_FOLDER, into small .rar files of 4MB each using batch file?
(or in other words, How to use the "Split to volumes, bytes" option using batch file?)
Thanks.
Thanks for the help!
I used the -v switch:
WinRAR a -r **-v4000** D:\MY_LARGE_FOLDER.rar D:\MY_LARGE_FOLDER\*.txt D:\MY_LARGE_FOLDER\
and I got now 4 files of 4000 bytes each but after opening some of the files I saw that the files are duplicated on more than one archive (e.g. on Part01.rar and on Part02.rar) ???
1. I also tried the -s (solid) switch and the result is the same?
How can I solve it?
There are two "manuals" installed with WinRAR:
The help file WinRAR.chm which has on tab Contents the item Command line mode with the subitem Switches with a link to page Switch -V<n>[k|b|f|m|M|g|G] - create volumes, and
the text file Rar.txt in program files folder of WinRAR which is the manual for console version Rar.exe. It contains nearly the same information as the help file regarding the available switches and their explanation.
I suggest to use in a batch file the console version with the command line:
"%ProgramFiles%\WinRAR\Rar.exe" a -cfg- -ep1 -idcdp -m5 -md4m -r -s -v4M "D:\MY_LARGE_FOLDER.rar" "D:\MY_LARGE_FOLDER\"
Console application Rar.exe compresses D:\MY_LARGE_FOLDER\ with all files and subfolders with folder name MY_LARGE_FOLDER included into an archive with nearly no output to console window using best compression creating a multivolumne solid archive with 4 MB dictionary size (in case of lots of small *.txt files) and 4 MB per archive file (volume).
There can be used alternatively:
"%ProgramFiles%\WinRAR\Rar.exe" a -cfg- -ep1 -inul -m5 -md4m -r -s -v4M "D:\MY_LARGE_FOLDER.rar" "D:\MY_LARGE_FOLDER"
That creates nearly same archive with the difference that folder name MY_LARGE_FOLDER is not included in the archive (backslash at end removed) and no message written to console window (-inul instead of -idcdp).
My solution for 20Mb volumes was:
"%ProgramFiles(x86)%\WinRAR.Rar.exe" a -cfg- -ep1 -idcdp -m5 -md4096 -r -s -v20M "C:\test.rar" "C:\test\"

How do I run a .bat file from CMake?

How do I run a .bat file from CMake in a pre-link or a post-build event?
You could use add_custom_command, e.g.
if(WIN32)
add_custom_command(TARGET <Your target>
POST_BUILD
COMMAND cmd //C <path to .bat file> <ARGS> )
endif()
For full details about add_custom_command run
cmake --help-command add_custom_command
The following also works. In case you read or create a file inside the bat script don't forget to specify the exact path inside the bat script.
ADD_CUSTOM_TARGET(
myCustomTarget
COMMAND cmd /c E:/Myfiles/mytxt.bat
)
ADD_DEPENDENCIES(myTarget myCustomTarget)
myTarget will be executed after myCustomTarget.

Resources