+3 votes
350 views
How to save CMD or PowerShell commands in txt file

in Windows 10 by (552k points)
reopened | 350 views

1 Answer

+4 votes
Best answer

1. How to export commands in CMD Windows 10
2. How to export commands in Windows PowerShell Windows 10

When the administration and support management of Windows 10 operating systems is within our roles, we know very well that the use of commands is a practical task to solve problems, analyze configurations or obtain information on aspects of both the system and its applications or internal components . These commands have been developed with the purpose of accessing the best details of each function for which they were created..

An additional task to improve the use and management of these commands is the possibility of exporting the result directly to a text file , this is essentially useful for much more direct support or control tasks since on the text file we can better visualize the results to detect where the root of the problem is and thus take the corresponding measures.

TechnoWikis will explain through this tutorial how we can export the results executed both in the command prompt and in Windows PowerShell to a text file and thus be able to improve our tasks on Windows 10..

To keep up, remember to subscribe to our YouTube channel! SUBSCRIBE


1. How to export commands in CMD Windows 10


The symbol of the Windows 10 system is the console that has been present for several decades, and will still be, for the execution of various tasks in Windows 10, whether it is the execution of orders, access to information, updating of components and many tasks. plus.
Step 1

To access the command prompt in Windows 10 we have the following options:

To keep up, remember to subscribe to our YouTube channel! SUBSCRIBE

Note
It is recommended that we access as administrators to export the results.
Step 2

Once there, the syntax for executing and exporting the result in txt is as follows:
 Command> Unit: \ "Path" .txt 
Step 3

For example, we will execute the "nslookup" command in a normal way and then we will export its result to the following path.
 C: \ CMD \ CMD.txt 
image
Step 4

With this syntax we can see that the result will be exported directly to the TXT file: image
Step 5

We proceed to open the text file and there we will find the result of the command executed: image
Step 6

We can apply this for any command to execute in CMD: image
Step 7

The final result in the text file will be: image
Note
If we want the result to also be displayed in the terminal, we will execute the following:
 Command> Unit: \ "Path" .txt | type Unit: \ "Path" .txt 

2. How to export commands in Windows PowerShell Windows 10

Windows PowerShell is one of the most powerful consoles that Microsoft has developed for support tasks since it has numerous cmdlets that allow access to detailed information, as well as execute multiple tasks there.

Step 1

For this purpose we must access Windows PowerShell as administrators and in the console we will execute the following syntax:
 Command | Out-File -FilePath c: \ ”Path” .txt 
Step 2

For example, we will execute the following:
 Get-Service | Out-File -FilePath C: \ CMD \ PowerShell.txt 
image
Step 3

Now, in the indicated path we will see the text file that has been exported: image
Step 4

When we open it we find the result of the Get-Service cmdlet which will display all the active services of the system: image
Step 5

We can see the content of the exported result through PowerShell we can do it using the Get-Content cmdlet like this:
 Get-Content -Path C: \ CMD \ PowerShell.txt 
image

We can see how these simple methods allow us to export these results and thus have better control over them..


by (3.5m points)
edited

Related questions

+4 votes
1 answer
asked Sep 16, 2019 in Windows 10 by backtothefuture (552k points) | 278 views
+5 votes
1 answer
+4 votes
1 answer
asked Aug 21, 2019 in Windows 10 by backtothefuture (552k points) | 255 views
+4 votes
1 answer
asked Sep 19, 2019 in Windows 10 by backtothefuture (552k points) | 343 views
+4 votes
1 answer
asked Nov 2, 2019 in Windows 10 by backtothefuture (552k points) | 300 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users