Skip to main content

Posts

Showing posts with the label cmd search

Notepad++ convert multiple lines to a single line and vice versa

Notepad++ is an awesome text editing tool, it can accept regex to process the text data. If the data is in a “.csv” format or comma separated values which is basically just a text file that can either be opened using a text editor, excel or even word. Notepad++ can process the contents of the file using regex. Example if the data has multiple rows or lines, and what is needed is to convert the whole lines of data into a single line. Notepad++ can easily do it using regex. However, if the data is on a single line and it needs to be converted into multiple lines or rows then regex can also be used for this case. Here’s an example on how to convert multiple rows or lines into a single line. Example data: Multiple rows, just a sample data. Press Ctrl+H, and  on "Find what" type: [\r\n]+ and on "Replace with" type with: , (white space) --white space is needed if need to have a space in between the data. See image below, "Regular Expression" must be se...

Check Windows Task Scheduler Status and Last Run Time

Task Scheduler is an awesome tool that every Sys Admin should be familiar with it. Task Scheduler in a way can help automate task, if the task is repetitive or a task that has to be done at a certain date and time, or a task has to be done once a week, once a month or even once a year. Task Scheduler is the best tool for this scenario. In this busy world of digital technology, who can keep remembering that a task must be done on a specific date and time. Yes, it might works once but as time goes on and task or jobs of a Sys Admin keep filing up chances are the task might be forgotten and the person-in-charge might just remember the things that needs to be done if there is an issue that happens already. So, Task Scheduler is a tool in which you test once, set if tested okay and forget about it. Test to make sure that the task to be set, works properly and just forgot about it; it will do the task repetitively albeit depends on the settings that was set. Of course, Task Scheduler...

How to open an elevated command prompt from a standard account?

Working in a fast pace environment, will need to get things done quickly to do other tasks that needs to be done also. Opening a command prompt in a standard user account without signing off and without logging off is possible with the “runas” utility command in Windows environment. Open the run box and type “ cmd ”, to open the command prompt window. Then type: Runas /user:admin_account cmd It will ask for a password, if authentication is valid then a new command prompt window will open in an elevated mode. Command works from Windows 7+  version. That’s it, you just open an elevated command prompt window in a user standard account. Since most users are hungry with the admin password, just watch out with the shoulder sniffing tactic. Other useful admin commands in a windows environment: If ever you have a custom local admin account name and you can’t remember, type: net users It will display all the local user accounts. To check domain ...

Disconnect Remote Desktop from command line

How to kill remote desktop sessions from the command line? How to close RDC sessions from the command line? One solution is to use batch file scripting or use PowerShell. For old timers batch file might be the preferred solution because you don't need to install anything, it  comes in handy with the native command prompt. Of course, PowerShell is also one of the best solutions; provided the environment is PowerShell ready. The method used below utilizes batch file or the command prompt, just like the good old DOS environment of yesterday. Command below can be run directly from the command prompt. To use batch file scripting open notepad and save the file with ".bat"  file extension. Once saved as a batch file, the script is ready for automation with the help of Task Scheduler. Here's the command: for /f "tokens=2,5" %a in ('netstat -ano ^| find "3389"') do echo %a & tskill %b /v For folks ...

Windows delete files in all directories

Deleting files are good and bad. It is good to delete files because it will tidy up your computer, get rid of unwanted or outdated files and free up space on the drive. It is bad to delete file or files if no backup is available and the data is of great importance. So deleting files should be done carefully and cautiously to make sure that deleted data will not be needed anymore. How to delete files automatically in all folders and subfolders? The batch file will come handy to automate file deletion. Below is an example that deletes files on the temp folder for any “dll” files. This can be applied to any folder path but don't do this on the c:\windows folder or the system will be completely unusable. Open a command prompt and copy and paste the commands below or save it to notepad and run the script as a batch file. C:\Users\\AppData\Local\Temp>FOR /f "tokens=*" %a in ('dir *.dll   /B /S') DO del %a Above command ...

Rename interface or network adapter name using PowerShell or Command line

How to rename interface or network adapter name using command line or Powershell? In  Windows network connection window, it shows the list of available network card on the computer, NICs are listed with its name, interface card vendor name (like Intel(R) I350 Gigabit) and its connection name whether it's domain network, local network, private or other network connection name. Network connections window can be access by typing "ncpa.cpl" from windows run box. Or typing "control cpa.cpl" from command line. Of course it can also be access via GUI from the control panel or task bar. To rename Interface name using netsh via command line: Netsh interface set interface name="Local Network" newname="Private LAN Network" If the server or computer has multiple nics; its better to set the interface name with identifiable name that best describes the interface connection. Netsh interface set interface name="Local Network" newnam...

Windows search location of files

Search directory and path location of Windows files using “where” command. Where is a command line tool. Since it's a command line tool it can be automated using a batch file or any scripting of your choice. Here’s an example of where command:           where /R  c:\users\username *.doc  *.xls                    Command above will find all document files and excel files in folders and subfolders of c:\users\username. /R is an option to search recursively. The above command just use a space as a delimiter to set a parameter for other files to include on the search. The complete path and file name for all files matching will be displayed. But it’s better to specify a specific path; the more folders to search recursively then the longer it takes to find the matching files.        where /R  c:\users\ ...

Change product key in Windows 10

How to change product key in Windows 10? Microsoft has provided an easy way of changing the product key in Windows 10 by launching an executable file via command line. Open command prompt, press together the Windows Key + R key to open run box. On run box, type "cmd" (don't include the quotes) and press enter or click the ok button. If the user account is not running with administrative privileges, system will prompt to enter the username and password for the account with admin rights. If the user account has admin rights, the command prompt window will open. On command prompt environment type: changepk and press enter Changepk.exe is a shortcut name for change product key. A window will open to enter or change the windows product key. See screen shot below for an example: Cheers..Hope it helps..  ----------------------------------------- Free Android app, download at Google play: Android Divine Mercy Chaplet Guide  ...

Quickly access command prompt or control panel in Windows 10

How to launch or access command prompt, control panel and programs and features in Windows 10? Microsoft provides a quick easy on how to do this. To launch "Programs and Features",  "Disk Management" and elevated command prompt can also be quickly access using the method below. On a laptop or desktop PC with Windows 10, right click on the windows logo, or the windows start button and a pop up menu is shown. See screen shot below: The windows run box is also part of the menu which provides quick access to run or open programs. Windows run box provides quick access to most of the programs if you are familiar with the application name. For example to launch Microsoft paint brush you can easily launch it from the run box by typing "pbrush" (don't include the quotes when typing).  Or to run word type "winword", If you have been using snip to capture images on your screen, you can also launch it using the run box by typing: snipp...

Check Task Scheduler using command line

Using command line to check Task Scheduler could be daunting sometimes if you are a GUI junkie. But if you need to monitor remote system definitely command line would be the best choice. And using command line process can be automated without user intervention. Here are some examples on how to use command line to check Task Scheduler.   schtasks /query /fo LIST /v > sch_all_task.txt Command line above will query task scheduler and redirect the output to sch_all_task.txt Redirecting to a text file is useful. You will have a copy of the result in a text file for record purposes. If the output is not redirected to a text file some of the result cannot be seen on the command line window. The above command will list all the scheduled tasks results running on task scheduler. To check a single scheduled Task in command line use this command below: C:\>schtasks /query /v /fo list   /TN "Monitor Files" Sample Output: ...

PowerShell search for files

Searching files in PowerShell is quite flexible in some ways. Why it's flexible? It provides a lot of option that you can type on cmdlet parameters. This code below will search for ".doc" and ".docx" files recursively in a given path. Get-ChildItem -Path "D:\My Docs Folder" -Filter *.doc* -Recurse If you have standard file naming convention, or you save files in a way that you could easily remember then PowerShell can also do it for you. Code below will search for any documents that its file name starts with Feb or feb. Get-ChildItem -Path "D:\My Docs Folder" -Filter Feb*.doc* -Recurse It's just document, the file name extension can be replace with *.xls* to search for excel worksheets or any file name extension such as ".png" or ".jpeg" or other video files or any type of file. Or if you searching for saved outlook messages, use *.msg to search for saved outlook emails. If...