Shell command to set system variable

English support forum

Moderators: white, sheep, Hacker, Stefan2

Post Reply
reekydeeky
Junior Member
Junior Member
Posts: 10
Joined: 2014-01-10, 15:27 UTC

Shell command to set system variable

Post by *reekydeeky » 2018-06-11, 09:02 UTC

Hello folks :)
Does anyone know a way to set a system variable from TC ? (windows)

eg (in cmd prompt) setx CurrentProject c:\projects\currentProject_XX

I can't find a way to set %CurrentProject% = [TC source] as a button.


In Maya it's invaluable (done via Python) as we're jumping between projects all the time. Would love to be able to do the same thing in TC

User avatar
Stefan2
Power Member
Power Member
Posts: 2183
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 » 2018-06-11, 09:36 UTC

Me guess:


Command: cmd /c
Parameters: setx CurrentProject %P


If that is the correct syntax for setx.



In opened button dialog, press F1 for more help...
Test:
Command: cmd /k
Parameters: ECHO %P



 

reekydeeky
Junior Member
Junior Member
Posts: 10
Joined: 2014-01-10, 15:27 UTC

Post by *reekydeeky » 2018-06-11, 09:52 UTC

Perfect !! Thank you Stefan 2
(it was the /c that I was missing .. you're a hero)

User avatar
MVV
Power Member
Power Member
Posts: 8131
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2018-06-18, 09:51 UTC

I believe that it would be better to quote %P to make it working with paths that contain spaces:

Code: Select all

Command: cmd.exe /c
Parameters: setx CurrentProject "%P"

Post Reply