Persistent DOSKEY and logging everything
Posted: 14 Jun 2017 07:11
Hello all,
This morning I was asked a rather unusual question, "can you in DOS make a command into an alias that runs the actual command typed in, but also echoes exactly what is typed into a log file along with a date/time-stamp? And it needs to be persistent on start up."
My first thought was definitely doskey, so:
DOSKEY ls=dir
will make the "dir" command run when "ls" is typed
The next part, persistence, seems solved with:
https://gist.github.com/vladikoff/38307908088d58af206b
However, I am really not coming up with a good way to make a log file of whatever gets typed.
I figure we can doskey anything, so if the syntax gets figured out then we could doskey the original command, plus the logging.
So if someone types
"net use c:\users\renfro\"
then it would end up echoing into a log file:
06/14/2017 09:08:00
net use c:\users\renfro\
I hope this question makes sense - it would really help solve a significant issue on our side
I recognize we would need to create a doskey for maybe a dozen dos commands.
-Aisha
This morning I was asked a rather unusual question, "can you in DOS make a command into an alias that runs the actual command typed in, but also echoes exactly what is typed into a log file along with a date/time-stamp? And it needs to be persistent on start up."
My first thought was definitely doskey, so:
DOSKEY ls=dir
will make the "dir" command run when "ls" is typed
The next part, persistence, seems solved with:
https://gist.github.com/vladikoff/38307908088d58af206b
However, I am really not coming up with a good way to make a log file of whatever gets typed.
I figure we can doskey anything, so if the syntax gets figured out then we could doskey the original command, plus the logging.
So if someone types
"net use c:\users\renfro\"
then it would end up echoing into a log file:
06/14/2017 09:08:00
net use c:\users\renfro\
I hope this question makes sense - it would really help solve a significant issue on our side
I recognize we would need to create a doskey for maybe a dozen dos commands.
-Aisha