For an assignment, I need to run a few commands in the terminal and save the entire session - both the output and commands - to a text file. Piping the Command Prompt commands saves only the output; in a Linux terminal I'd use the "script" command, but git-bash cannot find this command.
-
From a Windows command shell you can just copy the commands and output and save in a text file. I do this all the time when including example output in my answers.– DavidPostill ♦Commented Apr 3, 2019 at 19:37
-
look up how to copy and paste from the window– barlopCommented Apr 3, 2019 at 22:38
Add a comment
|
1 Answer
Since script command is available for Linux. Windows Command Prompt does not have script command. Git-Bash is also modified and formatted form of Windows Command Prompt so it also does not have script command. To have it Login to Linux machine from Git-Bash and proceed as per instruction. So to use script command:
- Either Login to a Linux Machine and run the script command and then run the command you need to run.
- Or do a ssh login on to a remote Linux Machine from Git-Bash and proceed further.
If want to same behavior on Windows:
- Write equivalent batch script for windows command prompt. By default command prompt first echo the command and then its output unless you use @echo off at the first line of batch script.
- Find a windows version of script command if someone have taken the pain to write for you still the command run on Linux can not be fully available on windows.
-
So if I understand you correctly, there is no built-in equivalent to "script" in the Windows environment? Commented Apr 4, 2019 at 3:15
-
Yes, there is no built-in but windows by default echos all the command before its execution. One can check that there is no "@echo off" is set. This will disable echoing. Commented Apr 4, 2019 at 7:55