2

Is it possible to save DOS command prompt history to a file?

I'm going to work in sqlplus and would like to save all commands that were used and executed in a log file.

Example, I would like to save all DOS commads executed in a DOS 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.

Delmonte
  • 301
  • 1
  • 7
  • 19
  • Try a different directory, that you create like `C:\temp`. UAC can kill that redirection silently when saving to a "system" directory, including root of C. – HopelessN00b Dec 20 '12 at 17:31
  • 1
    dos key logs what happens in the shell, now what happens within programs that are launched. – Zoredache Dec 20 '12 at 17:37

1 Answers1

3

Start Powershell, use the transcript functionality.

Start-transcript Initializes a transcript fi le and then creates a record of all subsequent actions in the PowerShell session. Use the following syntax:
Start-Transcript [[-path] FilePath] [-force] [-noClobber] [-append]

Stop-transcript Stops recording actions in the session and finalizes the transcript. Use the following syntax: Stop-Transcript

Zoredache
  • 130,897
  • 41
  • 276
  • 420