I am following a documentation and executing some commands in Windows 10 command prompt.

I have executed the first two commands using setx, since setx is the Windows' equivalent for export and when I try the third command $OPENAI_LOGDIR is not properly detected. Can someone help with the equivalent of this in windows?


export OPENAI_LOG_FORMAT='stdout,log,csv,tensorboard'
export OPENAI_LOGDIR=path/to/tensorboard/data

tensorboard --logdir=$OPENAI_LOGDIR

It depends on the shell. The $ symbol starts a name and indicates that's a variable in most Unix shells. To do the same in Windows cmd use %OPENAI_LOGDIR%. In Windows PowerShell use the same syntax as bash, i.e. $OPENAI_LOGDIR

SET OPENAI_LOG_FORMAT=stdout,log,csv,tensorboard
SET OPENAI_LOGDIR=C:\path\to\tensorboard\data
tensorboard --logdir=%OPENAI_LOGDIR%

The apostrophes in the Unix command simply say to treat the included text literally, reducing how much the Unix shell tries to interpret special characters. CMD.EXE (derived from COMMAND.COM) supports fewer special meanings for specific characters, so such apostrophes are often not needed.

In Unix, starting with a $ indicates a variable. For CMD, you can specify a variable with a percent sign at the start. In some cases, it is more clear if you place a percent sign on both sides of the variable name.

While Unix uses slashes to specify different directories, most programs that you run from CMD will typically uses backslashes to separate directories.

If you do prefer to use SETX, then ditch the equal signs (using spaces instead) and quotation marks might be recommended.

SETX OPENAI_LOG_FORMAT "stdout,log,csv,tensorboard"
SETX OPENAI_LOGDIR "C:\path\to\tensorboard\data"
tensorboard --logdir=%OPENAI_LOGDIR%

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.