本文介绍了在Windows中以管理员身份使用clink运行cmd以永久保存命令历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了clink,因为我想要一个Windows cmd界面来保存我正在介绍的命令的历史记录。问题是,即使您以管理员身份执行批处理文件Clink v0.4.9,clink始终以非管理员用户身份运行。
所以我想知道如何使Clink像故意执行的
一样运行。


解决方案

在批处理文件Clink v0.4.9中,最后几行写为

 :启动
开始链接; cmd.exe / s / k%〜dpnx0&;注入%clink_profile_arg%
出口/ b 0

所以您只需要为这些更改它们

 :启动
开始 Clink; cmd.exe / s / k将%V推入 %dpnx0&;注入%clink_profile_arg%
出口/ b 0

如果要检查您是否处于管理模式,请使用

 净会话

如以下stackoverflow帖子中所示



I downloaded clink because I wanted a windows cmd interface that saved the history of the commands I was introducing. The problem is that clink always run in a non admin user, even if you execute the Batch file Clink v0.4.9 as admin.So I want to know how to make Clink run as it isintentionally executed.

解决方案

In the Batch file Clink v0.4.9, the last lines are written as

:launch
start "Clink" cmd.exe /s /k ""%~dpnx0" inject %clink_profile_arg%"
exit /b 0

So you just need to change them for these

:launch
start "Clink" cmd.exe /s /k pushd ""%V"" ""%~dpnx0" inject %clink_profile_arg%"
exit /b 0

If you want to check whether you are in admin mode, use

net session 

as indicated in the following stackoverflow post

How to detect if CMD is running as Administrator/has elevated privileges?

Now you have a windows cmd which saves your command history permanently in user and admin modes.

这篇关于在Windows中以管理员身份使用clink运行cmd以永久保存命令历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 23:04