Shell command to set system variable

English support forum

Moderators: white, Hacker, petermad, Stefan2

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

Shell command to set system variable

Post by *reekydeeky »

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: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

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: 12
Joined: 2014-01-10, 15:27 UTC

Post by *reekydeeky »

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: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

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