setx语法无效 [英] Invalid syntax with setx

查看:1354
本文介绍了setx语法无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 setx 命令设置 OGRE_HOME

setx OGRE_HOME D:\Program Files\OgreSDK

现在我需要更改为 OGRE_HOME 的值。
如何搜索我设置的所有值?
如果我再次运行命令,它显示:

Now I need to change to value of OGRE_HOME. How can I search all the values I have set? If I run the command again, it shows that:

ERROR: Invalid syntax. Default option is not allowed more than '2' time(s).


推荐答案

您的Ogre SDK路径有空格它被解释为另一个参数的分隔符。将围绕您的路径,将其作为 setx 的一个参数:

Your path to the Ogre SDK has a space character in it, which is interpreted as a delimiter to another argument. Surround your path with " to keep it as one single argument to setx:

setx OGRE_HOME "D:\Program Files\OgreSDK"

要查看 OGRE_HOME 环境变量的当前值:

To see the current value of the OGRE_HOME environment variable:

echo %OGRE_HOME%

您可能需要打开一个新的命令提示符才能看到如果你设置它,然后尝试立即看到它的价值。

You may have to open a new command prompt shell to see the value if you set it and are then trying to immediately see it's value.

要查看所有当前设置的环境变量,只需运行:

To see all currently set environment variables, simply run:

set

仅显示环境具有特定前缀的变量(因此 FOO 将显示 FOOBAR FOOBAZ ),将该前缀放在设置之后:

To show only environment variables that have a certain prefix (so FOO would show FOOBAR and FOOBAZ), put that prefix after set:

set PREFIX

或者,您可以使用GUI编辑环境变量(假设Windows 7在这里)。

Alternatively, you can use the GUI to edit environment variables (assuming Windows 7 here).


  • 右键单击计算机,选择属性

  • 点击左窗格中的高级系统设置

  • 确保您位于高级选项卡在弹出的对话框

  • 点击底部
  • $ 环境变量...

  • Right-click Computer, choose Properties
  • Click Advanced system settings in the left pane
  • Make sure you're on the Advanced tab in the pop-up dialog
  • Click Environment Variables... at the bottom

一个对话框将弹出用户特定的环境变量以及系统环境变量。选择一个值并使用新建/编辑/删除按钮与它们进行交互。

A dialog will pop up with your user-specific environment variables as well as your system-wide environment variables. Select a value and use the New/Edit/Delete buttons to interact with them.

这篇关于setx语法无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆