我将在PowerShell中编写命令,它将输出我的进程名称和虚拟内存。我需要将我的值vm更改为兆字节。
def delete
...
prev_page = Dogs.page(params[:page]).per(20).count < 1 ? params[:page].to_i - 1 : params[:page]
redirect_back(fallback_location: dogs_path(page: prev_page, notice: "...", anchor: "if_you_wanted_to"))
end
我有这个
try {
JSONObject jObj = new JSONObject(response);
int intError = jObj.getInt("success");
Boolean error = (intError < 0) ? true : false;
if (!error){
// user successfully logged in
// Create login session
session.setLogin(true);
JSONArray verifiedMember = jObj.optJSONArray("VerifiedMember");
for (int i =0;i<verifiedMember.length();i++){
JSONObject rootObj = verifiedMember.getJSONObject(i);
String userId = rootObj.getString("user_id");
String first_name = rootObj.getString("first_name");
String email = rootObj.getString("phone");
// Inserting row in users table
db.addUser(first__name, email);
}
// Launch main activity
Intent intent = new Intent(LoginActivity.this,
MainActivity.class);
startActivity(intent);
finish();
}
} catch (JSONException e) {
e.printStackTrace();
}
如果进程有&gt;我还需要更改颜色100 Mb VM
答案 0 :(得分:3)
Format-Table
cmdlet不支持着色。你可以做的是change color for each row。
如果您愿意放弃漂亮的表格格式,请将结果传递给管道并使用Write-Host -ForegroundColor
指定单元格级别的颜色。像这样,
gwmi win32_process | select name,processid,vm | % {
$params = @{ Object = $_ }
$mem = $params["Object"].VM/1MB
if([int]$mem -ge 100 ) {
write-host -nonewline -foregroundcolor yellow $mem " "
} else {
write-host -nonewline $mem " "
}
write-host $params["Object"].name " " $params["Object"].processid
}
另一种方法是基于将结果保存在某些临时介质上并稍后添加着色。这需要更多代码。 Petri的a nice example代码比我愿意在这里复制更多代码。