•  ru
ShellHacks
Command-Line Tips and Tricks

windows

  • Blog

Batch File Comment (Remark) – Windows

Posted on Thursday November 19th, 2020by admin

A batch file (batch script) in Windows is a text file that typically has a .bat extension and includes one or more command prompt commands. It is a good practice to comment a source code in a batch file by leaving the remarks that explain functionality of some lines or blocks of code. Also any […]

Read More
No comments yet
  • Blog

Windows: Get Process Name From PID

Posted on Saturday October 31st, 2020by admin

The process identifier (a.k.a. process ID or PID) is a number used to uniquely identify an active process. In this short note i will show how to display information about the Windows process (incl. the process name and path to an executable file) by PID from the command-line prompt (CMD) or a Windows PowerShell.

Read More
No comments yet
  • Blog

Windows: `Touch` Command – Equivalent

Posted on Wednesday October 28th, 2020by admin

The touch command in Linux is used to change a file’s “Access“, “Modify” and “Change” timestamps to the current time and date, but if the file doesn’t exist, the touch command creates it. If you simply want to create an empty file from the command-line prompt (CMD) or a Windows PowerShell – the type and […]

Read More
1 Comment
  • Blog

Windows: Uptime Command – CMD & PowerShell

Posted on Friday October 23rd, 2020by admin

Even though there is still no built-in Windows uptime command, the actual uptime of the server/workstation or the system boot time can be checked from the command-line. In this note i will show several methods of how to check Windows uptime from the command-line prompt and PowerShell.

Read More
1 Comment
  • Blog

Windows: Shutdown/Reboot Event IDs – Get Logs

Posted on Tuesday September 1st, 2020Tuesday September 1st, 2020by admin

While troubleshooting an issue that causes an unexpected reboot or shutdown of a Windows machine, it is important to know which event IDs are related to system reboot/shutdown and how to find the appropriate logs. In this note i am publishing all the event IDs related to reboots/shutdowns. I am also showing how to display […]

Read More
No comments yet
  • Blog

Auto Answer “Yes/No” to Prompt – PowerShell & CMD

Posted on Wednesday August 19th, 2020by admin

Some scripts or commands executed in Windows PowerShell or CMD may ask interactive questions that have to be responded with “Yes” or “No” answers. To know how to answer these interactive questions automatically is very handy for different automations. In this note i will show how to respond “Yes” or “No” to prompts in Windows […]

Read More
No comments yet
  • Blog

PowerShell: Multi-Line Command

Posted on Wednesday August 19th, 2020by admin

For better readability it is convenient to split long commands over multiple lines. In Windows PowerShell a multi-line command can be created from a long command by splitting it using the backquote character. In this note i will show an example of how to split a long command over multiple lines in PowerShell.

Read More
No comments yet
  • Blog

PowerShell: History – Get Command History

Posted on Friday August 14th, 2020by admin

The Get-History command in PowerShell lists only the commands entered during the current session. To get the list of all previously executed commands it is required to locate the file where these commands are stored. In this note i will show how to locate the history file and list all commands executed previously in PowerShell.

Read More
No comments yet
  • Blog

Windows: Run as Different User

Posted on Monday June 15th, 2020Monday June 15th, 2020by admin

Sometimes it is required to run an application as a different user. For example, you may want to run an elevated command prompt to execute some commands with administrative privileges. In Windows, an executable file can be run as a different user from the File Explorer or using the command line.

Read More
No comments yet
  • Blog

PowerShell: Check If Port is Open – Test TCP Connection

Posted on Monday May 4th, 2020Wednesday May 6th, 2020by admin

During troubleshooting of different issues it is often required to check if some TCP port on a remote host is opened and ensure that it is not blocked by a firewall. The most common tool for this is telnet, but it may not be installed or you may want to be able to copy the […]

Read More
5 Comments

Posts navigation

Older posts

Online Tools

  • Base64 Decode
  • Base64 Encode

Tags

access-control anonymity ansible apache archive artifactory aws bash boot cmd command-line curl dns docker encryption git java jenkins kubernetes linux mail mongodb mysql network nmap openssl oracle password pdf performance powershell prometheus proxy python rabbitmq raspberry pi redis ssh systemd telnet text-processing tor tsm windows yum
  • Twitter
  • RSS
Privacy
Copyright © 2011-2020 | www.ShellHacks.com