2

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?

commands

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

tensorboard --logdir=$OPENAI_LOGDIR
phuclv
  • 27,773
chink
  • 121

2 Answers2

2

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. However if it's an environment variable in PowerShell you need to access use the env: prefix: $env:OPENAI_LOGDIR

phuclv
  • 27,773
0
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%
TOOGAM
  • 15,798
  • 5
  • 43
  • 63