如果有人能提出解决该问题的方法,而不是消除这家公司的奇迹般的举动,那么Microsoft无限的惊喜之盒,将是一件令人高兴的事情:
我在Windows 10上添加了LOG_LEVEL
作为系统环境变量,并将其值设置为INFO
。
然后(仅在按OK键并关闭该窗口之后),我打开了一个命令行终端,然后输入echo %LOG_LERVEL%
,它会打印... %LOG_LEVEL%
。
当我在添加我的环境变量之前尝试过同样的环境变量时,例如-echo %OS%
,它会显示Windows_NT
。
现在,我试图以几种不同的路径关闭并重新打开命令行终端。
在其中一个(我现在无法再复制)中,命令确实打印了INFO
(我的变量的值)。
当我使用Power Shell(Microsoft在上次更新时将其推入系统的新命令行终端,迫使旧命令行从上下文菜单中消失)尝试相同的操作时,情况变得更糟,因为它既无法识别我添加的变量,也无法识别之前存在的其他变量。
对于上述相同示例,echo %OS%
打印%OS%
。
有人会知道这里到底是怎么回事,这家公司发布的每个简单功能怎么会把普通用户的生活变成一场噩梦呢?
非常感谢,请原谅此问题中表达的过分愤怒!
答案 0 :(得分:0)
Powershell不是cmd.exe。 如果您想在Powershell中打印出系统变量的值,则可以使用
echo
或调用cmd.exe并执行您习惯的cmd.exe /c "echo %LOG_LEVEL%"
命令
public class MyView extends View {
int counter1 = 0, counter2 = 0, counter3 = 0, counter4 = 0, counter5 = 0;
float cellWidth, cellHeight, height, width;
Paint paint = new Paint();
public MyView(Context context, AttributeSet attrs) {
super(context, attrs);
paint.setColor(Color.BLACK);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(10);
pBlack.setColor(Color.BLACK);
pWhite.setColor(Color.WHITE);
}
public MyView(Context context) {
super(context);
}
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawRect(0, counter1, cellWidth, cellHeight + counter1, paint);
canvas.drawRect(0, counter1, cellWidth * 2, cellHeight + counter1, paint);
canvas.drawRect(0, counter1, cellWidth * 3, cellHeight + counter1, paint);
canvas.drawRect(0, counter2 + cellHeight, cellWidth, cellHeight * 2 + counter2, paint);
canvas.drawRect(0, counter2 + cellHeight, cellWidth * 2, cellHeight * 2 + counter2, paint);
canvas.drawRect(0, counter2 + cellHeight, cellWidth * 3, cellHeight * 2 + counter2, paint);
canvas.drawRect(0, counter3 + cellHeight * 2, cellWidth, cellHeight * 3 + counter3, paint);
canvas.drawRect(0, counter3 + cellHeight * 2, cellWidth * 2, cellHeight * 3 + counter3, paint);
canvas.drawRect(0, counter3 + cellHeight * 2, cellWidth * 3, cellHeight * 3 + counter3, paint);
canvas.drawRect(0, counter4 + cellHeight * 3, cellWidth, cellHeight * 4 + counter4, paint);
canvas.drawRect(0, counter4 + cellHeight * 3, cellWidth * 2, cellHeight * 4 + counter4, paint);
canvas.drawRect(0, counter4 + cellHeight * 3, cellWidth * 3, cellHeight * 4 + counter4, paint);
canvas.drawRect(0, -cellHeight + counter5, cellWidth, 0 + counter5, paint);
canvas.drawRect(0, -cellHeight + counter5, cellWidth * 2, 0 + counter5, paint);
canvas.drawRect(0, -cellHeight + counter5, cellWidth * 3, 0 + counter5, paint);
}
private Runnable animate = new Runnable() {
@Override
public void run() {
if (counter1 < cellHeight) {
counter1 += 5;
} else {
counter1 = 0;
}
if (counter2 < cellHeight) {
counter2 += 5;
} else {
counter2 = 0;
}
if (counter3 < cellHeight) {
counter3 += 5;
} else {
counter3 = 0;
}
if (counter4 < cellHeight) {
counter4 += 5;
} else {
counter4 = 0;
}
if (counter5 < cellHeight) {
counter5 += 5;
} else {
counter5 = 0;
}
invalidate();
postDelayed(this, 10);
}
};
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int parentHeight = MeasureSpec.getSize(heightMeasureSpec);
int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
height = parentHeight;
width = parentWidth;
cellHeight = parentHeight / 4;
cellWidth = parentWidth / 3;
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
如果您真的讨厌powershell并想返回到旧的cmd.exe,我相信您可以(仍然)这样做。在这里阅读:https://support.microsoft.com/en-us/help/4027690/windows-powershell-is-replacing-command-prompt
答案 1 :(得分:0)
确保您没有像我一样犯一个愚蠢的错误,并在错误的位置键入了变量名。 就我而言,我花了一段时间(甚至在检查之后)注意到我将变量设置为JAVE_HOME而不是JAVA_HOME
Do!
答案 2 :(得分:0)
如果您在命令行窗口中使用了“set”,则会创建一个临时环境变量,该变量在您关闭窗口时会丢失。如果你想要一个永久的,你可以使用“setx”或使用控制面板中的系统属性对话框。