• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 485
  • Last Modified:

Saving windows command prompt history to a file

Hello,
Is possible to save windows command prompt history to a file?
I'm going to work in sqlplus and would like to save in a log file all commands that were used and executed.
Example, would like to save all commads executed in a session:

C:\> sqlplus /nolog
sql> connect / as sysdba
sql> select * from v$version;
etc, etc

I tried to do before:
doskey /history >> C:\commands.log

But it does not record anything. I'm in a Windows Server 2008 64 bits.
0
miyahira
Asked:
miyahira
1 Solution
 
käµfm³d 👽Commented:
Use the SQLPlus command spool:

spool C:\commands.log
[some commands]
spool off

Open in new window


Note that this will output the results of the queries you run as well. I can't recall if there's a way to prevent that, but I think there is.

http://www.adp-gmbh.ch/ora/sqlplus/spool.html
0
 
ReneGeCommented:
You could also run it as a batch file like:
start "" thebatchfile.bat >>"Log File.log"
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now