Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 143
» Latest member: markedison01
» Forum threads: 13,029
» Forum posts: 13,908

Full Statistics

Online Users
There are currently 703 online users.
» 1 Member(s) | 700 Guest(s)
Bing, Google, Prestamos USA

Latest Threads
Prestamos USA
Prestamos Personales On L...

Forum: Site News & Announcements
Last Post: Prestamos USA
4 minutes ago
» Replies: 0
» Views: 4
Prestamos USA
Paginas De Prestamos Bilo...

Forum: Site News & Announcements
Last Post: Prestamos USA
20 minutes ago
» Replies: 0
» Views: 2
Prestamos USA
Creditos Personales En Li...

Forum: Site News & Announcements
Last Post: Prestamos USA
35 minutes ago
» Replies: 0
» Views: 9
Prestamos USA
Solicitar Credito Persona...

Forum: Site News & Announcements
Last Post: Prestamos USA
52 minutes ago
» Replies: 0
» Views: 17
Prestamos USA
check it out j40lye

Forum: Site News & Announcements
Last Post: Prestamos USA
1 hour ago
» Replies: 121
» Views: 8,824
Prestamos USA
Prestamos On Line Rapidos...

Forum: Site News & Announcements
Last Post: Prestamos USA
1 hour ago
» Replies: 0
» Views: 26
Prestamos USA
Necesito Un Prestamo Pers...

Forum: Site News & Announcements
Last Post: Prestamos USA
1 hour ago
» Replies: 0
» Views: 31
Prestamos USA
Microcredito Minot ND

Forum: Site News & Announcements
Last Post: Prestamos USA
1 hour ago
» Replies: 0
» Views: 39
Prestamos USA
Guide to Turning On or Of...

Forum: Windows 10
Last Post: Prestamos USA
1 hour ago
» Replies: 1
» Views: 1,910
Prestamos USA
Como Consigo Un Prestamo ...

Forum: Site News & Announcements
Last Post: Prestamos USA
1 hour ago
» Replies: 1
» Views: 138

 
  Comprehensive List of Mtee Commands with Descriptions
Posted by: Sneakyone - 09-03-2024, 02:13 AM - Forum: Batch & Shell Scripting - No Replies

Comprehensive List of Mtee Commands with Descriptions

**Mtee** is a command-line utility that allows you to tee (duplicate) the output of a command to multiple destinations, such as files and the console, simultaneously. Below is a detailed list of Mtee commands, along with descriptions and examples.



1. Basic Output to File and Console
Description: Redirects the output of a command to both a file and the console.
Code:
command | mtee [OutputFile]
Example: To list directory contents and save the output to `output.txt` while displaying it in the console:
Code:
dir | mtee output.txt

2. Append Output to a File
Description: Appends the output of a command to an existing file rather than overwriting it.
Code:
command | mtee -a [OutputFile]
Example: To append the output of a directory listing to `output.txt`:
Code:
dir | mtee -a output.txt

3. Suppress Output to Console
Description: Redirects the output of a command to a file while suppressing the output to the console.
Code:
command | mtee -q [OutputFile]
Example: To save the output of `dir` to `output.txt` without displaying it in the console:
Code:
dir | mtee -q output.txt

4. Writing Output to Multiple Files
Description: Redirects the output of a command to multiple files simultaneously.
Code:
command | mtee [OutputFile1] [OutputFile2]
Example: To save the output of `dir` to both `output1.txt` and `output2.txt`:
Code:
dir | mtee output1.txt output2.txt

5. Redirecting Output and Error Streams to Different Files
Description: Redirects standard output and standard error streams to different files.
Code:
command 1> [OutputFile] 2> [ErrorFile]
Example: To save standard output to `output.txt` and errors to `error.txt`:
Code:
dir 1> output.txt 2> error.txt

6. Combining Output and Error Streams
Description: Combines both standard output and standard error streams and writes them to a single file.
Code:
command 2>&1 | mtee [OutputFile]
Example: To save both standard output and errors to `output.txt`:
Code:
dir 2>&1 | mtee output.txt

7. Using Mtee with a Delayed Command Execution
Description: Delays the execution of a command and redirects the output to a file.
Code:
timeout /t [Seconds] >nul & command | mtee [OutputFile]
Example: To wait for 5 seconds before listing the directory contents and saving the output to `output.txt`:
Code:
timeout /t 5 >nul & dir | mtee output.txt

8. Piping Output Through Multiple Commands
Description: Pipes the output of a command through multiple commands, with Mtee capturing the final output.
Code:
command1 | command2 | mtee [OutputFile]
Example: To list directory contents, filter for `.txt` files, and save the output to `output.txt`:
Code:
dir | findstr ".txt" | mtee output.txt

9. Redirecting Input from a File
Description: Uses Mtee to process the contents of a file through a command.
Code:
type [InputFile] | command | mtee [OutputFile]
Example: To display the contents of `input.txt`, process it, and save the output to `output.txt`:
Code:
type input.txt | findstr "search_string" | mtee output.txt

10. Logging Output with Timestamping
Description: Logs command output to a file with a timestamp for each entry.
Code:
command | mtee -t [OutputFile]
Example: To log the output of a command with timestamps to `log.txt`:
Code:
dir | mtee -t log.txt

11. Displaying Help Information
Description: Displays help information for the Mtee command, listing all available options and their descriptions.
Code:
mtee -?
Example: To display help information for Mtee:
Code:
mtee -?



Conclusion

The **Mtee** command is a versatile tool for duplicating the output of commands to multiple destinations, making it ideal for logging, debugging, and output management. By mastering these commands, you can effectively manage and control the output of your scripts and commands on Windows systems.

Happy Scripting!

Print this item

  Comprehensive List of MBR Commands with Descriptions
Posted by: Sneakyone - 09-03-2024, 02:11 AM - Forum: Batch & Shell Scripting - Replies (1)

Comprehensive List of MBR Commands with Descriptions

**MBR** (Master Boot Record) is a command-line utility used for managing and manipulating the Master Boot Record on a disk. Below is a detailed list of MBR commands, along with descriptions and examples.



1. Backing Up the Master Boot Record
Description: Creates a backup of the MBR from a specified disk and saves it to a file.
Code:
mbr.exe -b [OutputFile] [Disk]
Example: To back up the MBR of disk 0 to `mbr_backup.bin`:
Code:
mbr.exe -b mbr_backup.bin \\.\PhysicalDrive0

2. Restoring the Master Boot Record
Description: Restores the MBR from a backup file to a specified disk.
Code:
mbr.exe -r [InputFile] [Disk]
Example: To restore the MBR to disk 0 from `mbr_backup.bin`:
Code:
mbr.exe -r mbr_backup.bin \\.\PhysicalDrive0

3. Displaying the Master Boot Record
Description: Displays the contents of the MBR on a specified disk in hexadecimal format.
Code:
mbr.exe -d [Disk]
Example: To display the MBR of disk 0:
Code:
mbr.exe -d \\.\PhysicalDrive0

4. Clearing the Master Boot Record
Description: Clears (zeros out) the MBR on a specified disk, effectively removing the partition table and boot code.
Code:
mbr.exe -c [Disk]
Example: To clear the MBR on disk 0:
Code:
mbr.exe -c \\.\PhysicalDrive0
Warning: This operation will destroy all partition information on the disk.

5. Writing a Custom MBR
Description: Writes a custom MBR from a binary file to a specified disk.
Code:
mbr.exe -w [InputFile] [Disk]
Example: To write a custom MBR from `custom_mbr.bin` to disk 0:
Code:
mbr.exe -w custom_mbr.bin \\.\PhysicalDrive0

6. Verifying the Integrity of the MBR
Description: Compares the MBR on a specified disk with a backup file to verify its integrity.
Code:
mbr.exe -v [InputFile] [Disk]
Example: To verify the MBR on disk 0 against `mbr_backup.bin`:
Code:
mbr.exe -v mbr_backup.bin \\.\PhysicalDrive0

7. Displaying the Partition Table
Description: Displays the partition table entries within the MBR of a specified disk.
Code:
mbr.exe -p [Disk]
Example: To display the partition table on disk 0:
Code:
mbr.exe -p \\.\PhysicalDrive0

8. Editing the Partition Table
Description: Manually edits the partition table entries in the MBR of a specified disk.
Code:
mbr.exe -e [Disk]
Example: To edit the partition table on disk 0:
Code:
mbr.exe -e \\.\PhysicalDrive0
Note: Use this command with caution, as incorrect edits can make the disk unbootable.

9. Restoring the MBR from a Standard MBR File
Description: Restores the MBR using a standard MBR binary file provided by the utility or the operating system.
Code:
mbr.exe -s [Disk]
Example: To restore the standard MBR to disk 0:
Code:
mbr.exe -s \\.\PhysicalDrive0

10. Logging Operations to a File
Description: Logs the details of MBR operations to a specified file for auditing or troubleshooting purposes.
Code:
mbr.exe -l [LogFile] [Command] [Disk]
Example: To log the MBR backup operation to `mbr_log.txt`:
Code:
mbr.exe -l mbr_log.txt -b mbr_backup.bin \\.\PhysicalDrive0

11. Displaying Help Information
Description: Displays help information for the MBR command, listing all available options and their descriptions.
Code:
mbr.exe -h
Example: To display help information for the MBR utility:
Code:
mbr.exe -h



Conclusion

The **MBR** utility is a powerful tool for managing and manipulating the Master Boot Record on a disk. By mastering these commands, you can efficiently back up, restore, and edit the MBR, ensuring the integrity and bootability of your systems.

Happy Managing!

Print this item

  Comprehensive List of Hidec Commands with Descriptions
Posted by: Sneakyone - 09-03-2024, 02:08 AM - Forum: Batch & Shell Scripting - Replies (1)

Comprehensive List of Hidec Commands with Descriptions

**Hidec** is a command-line utility used to run console applications or batch files silently, without displaying a command prompt window. This is particularly useful for scripts or commands that need to run in the background without user interaction. Below is a detailed list of Hidec commands, along with descriptions and examples.



1. Running a Command Silently
Description: Executes a specified command or script without displaying the command prompt window.
Code:
hidec.exe [Command]
Example: To run `example.bat` silently:
Code:
hidec.exe example.bat

2. Running a Command with Arguments
Description: Executes a specified command with arguments, hiding the command prompt window.
Code:
hidec.exe [Command] [Arguments]
Example: To run `example.bat` with arguments `arg1` and `arg2` silently:
Code:
hidec.exe example.bat arg1 arg2

3. Running a System Command Silently
Description: Executes a built-in system command, such as `dir`, without displaying the command prompt window.
Code:
hidec.exe cmd /c [SystemCommand]
Example: To run the `dir` command silently:
Code:
hidec.exe cmd /c dir

4. Running a Command with a Specific Working Directory
Description: Executes a command or script from a specified working directory without displaying the command prompt window.
Code:
hidec.exe /d [Directory] [Command]
Example: To run `example.bat` from `C:\Scripts` silently:
Code:
hidec.exe /d C:\Scripts example.bat

5. Running a Command and Redirecting Output to a File
Description: Executes a command silently and redirects the output to a specified file.
Code:
hidec.exe [Command] > [OutputFile]
Example: To run `example.bat` and redirect output to `output.txt`:
Code:
hidec.exe example.bat > output.txt

6. Running a Command Silently with Administrator Privileges
Description: Executes a command or script with elevated (Administrator) privileges, hiding the command prompt window. This typically requires using the `runas` command.
Code:
hidec.exe runas /user:Administrator "cmd /c [Command]"
Example: To run `example.bat` as Administrator silently:
Code:
hidec.exe runas /user:Administrator "cmd /c example.bat"

7. Running a Batch File Silently
Description: Executes a batch file without displaying the command prompt window.
Code:
hidec.exe [BatchFile]
Example: To run `cleanup.bat` silently:
Code:
hidec.exe cleanup.bat

8. Running a PowerShell Script Silently
Description: Executes a PowerShell script without displaying the PowerShell window.
Code:
hidec.exe powershell -executionpolicy bypass -file [ScriptPath]
Example: To run `script.ps1` silently:
Code:
hidec.exe powershell -executionpolicy bypass -file script.ps1

9. Running a Command and Logging Output to a File
Description: Executes a command or script silently and logs both standard output and error output to a specified file.
Code:
hidec.exe [Command] > [LogFile] 2>&1
Example: To run `example.bat` and log all output to `log.txt`:
Code:
hidec.exe example.bat > log.txt 2>&1

10. Running a Command and Appending Output to a File
Description: Executes a command silently and appends the output to a specified file.
Code:
hidec.exe [Command] >> [OutputFile]
Example: To run `example.bat` and append output to `output.txt`:
Code:
hidec.exe example.bat >> output.txt

11. Running a Command and Waiting for Completion
Description: Runs a command silently and waits for it to complete before returning control to the command prompt.
Code:
hidec.exe /w [Command]
Example: To run `example.bat` and wait for it to finish:
Code:
hidec.exe /w example.bat

12. Displaying Help Information
Description: Displays help information for the Hidec command, listing all available options and their descriptions.
Code:
hidec.exe /?
Example: To display help information for Hidec:
Code:
hidec.exe /?



Conclusion

The **Hidec** command is a useful utility for running scripts and commands in the background without displaying a command prompt window. By mastering these commands, you can effectively automate tasks, run background processes, and manage scripts discreetly on Windows systems.

Happy Scripting!

Print this item

  Comprehensive List of Handle Commands with Descriptions
Posted by: Sneakyone - 09-03-2024, 02:04 AM - Forum: Batch & Shell Scripting - Replies (1)

Comprehensive List of Handle Commands with Descriptions

**Handle** is a command-line utility from Sysinternals that provides detailed information about open handles for any process in a Windows system. Below is a detailed list of Handle commands, along with descriptions and examples.



1. Display All Open Handles
Description: Lists all open handles in the system.
Code:
handle.exe
Example: To display all open handles in the system:
Code:
handle.exe

2. Filter Handles by Process Name
Description: Lists all open handles for a specific process by name.
Code:
handle.exe [ProcessName]
Example: To display all open handles for the `notepad.exe` process:
Code:
handle.exe notepad.exe

3. Filter Handles by Process ID (PID)
Description: Lists all open handles for a specific process by its PID.
Code:
handle.exe -p [PID]
Example: To display all open handles for the process with PID 1234:
Code:
handle.exe -p 1234

4. Close a Specific Handle
Description: Closes a specific handle, typically used to release locked files.
Code:
handle.exe -c [Handle] -p [PID]
Example: To close the handle `0x1234` for the process with PID 1234:
Code:
handle.exe -c 0x1234 -p 1234

5. Filter Handles by Type
Description: Lists all handles of a specific type (e.g., File, Registry, Event) across all processes.
Code:
handle.exe -t [Type]
Example: To list all file handles in the system:
Code:
handle.exe -t File

6. Search for Handles to a Specific File or Object
Description: Searches for handles that are accessing a specific file or object path.
Code:
handle.exe [ObjectPath]
Example: To find which processes have a handle open to `C:\Temp\file.txt`:
Code:
handle.exe C:\Temp\file.txt

7. Display Handle Information with Details
Description: Displays detailed information about each handle, including the type, access, and object information.
Code:
handle.exe -v
Example: To display detailed information for all handles:
Code:
handle.exe -v

8. Show Handle Numbers in Hexadecimal Format
Description: Displays handle numbers in hexadecimal format, which is useful for closing specific handles.
Code:
handle.exe -x
Example: To display handle numbers in hexadecimal format:
Code:
handle.exe -x

9. List Handles for a Specific Object Type
Description: Lists all handles of a specific object type, such as `File`, `Mutant`, or `Section`.
Code:
handle.exe -t [ObjectType]
Example: To list all `Mutant` (mutex) handles:
Code:
handle.exe -t Mutant

10. Show Only Handles with Specific Access Rights
Description: Displays only handles that have specific access rights, such as `READ` or `WRITE`.
Code:
handle.exe -a [AccessRights]
Example: To display handles with `WRITE` access rights:
Code:
handle.exe -a WRITE

11. Display Help Information
Description: Displays help information for the Handle command, listing all available options and their descriptions.
Code:
handle.exe -?
Example: To display help information for Handle:
Code:
handle.exe -?



Conclusion

The **Handle** command is a powerful utility for managing and inspecting open handles on a Windows system. By mastering these commands, you can efficiently troubleshoot locked files, diagnose system issues, and manage process resources.

Happy Troubleshooting!

Print this item

  Comprehensive List of GSAR Commands with Descriptions
Posted by: Sneakyone - 09-03-2024, 02:03 AM - Forum: Batch & Shell Scripting - No Replies

Comprehensive List of GSAR Commands with Descriptions

**GSAR** (Global Search And Replace) is a command-line utility used for performing search and replace operations on binary and text files. Below is a detailed list of GSAR commands, along with descriptions and examples.



1. Basic Search and Replace
Description: Replaces all occurrences of a specified search string with a replacement string in a file.
Code:
gsar -s"search_string" -r"replacement_string" [file]
Example: To replace "foo" with "bar" in `example.txt`:
Code:
gsar -s"foo" -r"bar" example.txt

2. Case-Insensitive Search and Replace
Description: Replaces all occurrences of a search string with a replacement string, ignoring the case.
Code:
gsar -i -s"search_string" -r"replacement_string" [file]
Example: To replace "Foo" or "foo" with "bar" in `example.txt`:
Code:
gsar -i -s"foo" -r"bar" example.txt

3. Replace First Occurrence Only
Description: Replaces only the first occurrence of the search string in the file.
Code:
gsar -o -s"search_string" -r"replacement_string" [file]
Example: To replace only the first occurrence of "foo" with "bar" in `example.txt`:
Code:
gsar -o -s"foo" -r"bar" example.txt

4. Replace and Create a Backup of the Original File
Description: Replaces all occurrences of a search string and creates a backup of the original file.
Code:
gsar -b -s"search_string" -r"replacement_string" [file]
Example: To replace "foo" with "bar" in `example.txt` and create a backup:
Code:
gsar -b -s"foo" -r"bar" example.txt
Note: The backup file will have the original filename with an additional `~` character.

5. Search and Replace with a Specific Offset
Description: Starts the search and replace operation at a specified byte offset within the file.
Code:
gsar -s"search_string" -r"replacement_string" -o[byte_offset] [file]
Example: To start replacing "foo" with "bar" starting at byte offset 100:
Code:
gsar -s"foo" -r"bar" -o100 example.txt

6. Search and Replace in a Specific Range
Description: Replaces occurrences of a search string within a specified byte range in the file.
Code:
gsar -s"search_string" -r"replacement_string" -n[start_offset] -m[end_offset] [file]
Example: To replace "foo" with "bar" between bytes 100 and 200 in `example.txt`:
Code:
gsar -s"foo" -r"bar" -n100 -m200 example.txt

7. Show Matching Lines Only (Silent Mode)
Description: Shows only the lines that contain the matching search string, without modifying the file.
Code:
gsar -s"search_string" -r"replacement_string" -I [file]
Example: To display lines containing "foo" in `example.txt` without replacing them:
Code:
gsar -s"foo" -r"bar" -I example.txt

8. Count the Number of Replacements
Description: Displays the number of replacements made in the file.
Code:
gsar -s"search_string" -r"replacement_string" -c [file]
Example: To count the number of times "foo" is replaced with "bar" in `example.txt`:
Code:
gsar -s"foo" -r"bar" -c example.txt

9. Replace with a Binary String
Description: Replaces a search string with a binary sequence in the file.
Code:
gsar -s"search_string" -r"\x[hex_value]" [file]
Example: To replace "foo" with a newline character in `example.txt`:
Code:
gsar -s"foo" -r"\x0A" example.txt

10. Replace Using Hexadecimal Search and Replace Strings
Description: Uses hexadecimal values for both the search and replace strings.
Code:
gsar -s"\x[search_hex]" -r"\x[replace_hex]" [file]
Example: To replace the hexadecimal value `0x666F6F` ("foo") with `0x626172` ("bar") in `example.txt`:
Code:
gsar -s"\x666F6F" -r"\x626172" example.txt

11. Replace with Confirmation
Description: Prompts the user for confirmation before replacing each occurrence.
Code:
gsar -s"search_string" -r"replacement_string" -p [file]
Example: To replace "foo" with "bar" in `example.txt` with confirmation:
Code:
gsar -s"foo" -r"bar" -p example.txt

12. Invert Match (Replace Non-Matching Lines)
Description: Replaces lines that do not match the search string.
Code:
gsar -v -s"search_string" -r"replacement_string" [file]
Example: To replace all lines not containing "foo" with "bar":
Code:
gsar -v -s"foo" -r"bar" example.txt

13. Use Regular Expressions for Search and Replace
Description: Uses regular expressions for more advanced search and replace operations.
Code:
gsar -r"regex_search" -r"regex_replace" [file]
Example: To replace all occurrences of digits with "number":
Code:
gsar -r"\d+" -r"number" example.txt

14. Perform a Dry Run (No Changes Made)
Description: Simulates the search and replace operation without making any changes to the file.
Code:
gsar -s"search_string" -r"replacement_string" -t [file]
Example: To simulate replacing "foo" with "bar" in `example.txt`:
Code:
gsar -s"foo" -r"bar" -t example.txt

15. Display Help Information
Description: Displays help information for the GSAR command, listing all available options and their descriptions.
Code:
gsar -h
Example: To display help information for GSAR:
Code:
gsar -h



Conclusion

The **GSAR** command is a powerful utility for performing search and replace operations in binary and text files. By mastering these commands, you can efficiently manipulate and modify file contents, whether for data processing, text manipulation, or binary file editing.

Happy Editing!

Print this item

  Comprehensive List of Grep Commands with Descriptions
Posted by: Sneakyone - 09-03-2024, 02:01 AM - Forum: Batch & Shell Scripting - No Replies

Comprehensive List of Grep Commands with Descriptions

**grep** (Global Regular Expression Print) is a command-line utility used for searching and filtering text in files or standard input using regular expressions. Below is a detailed list of grep commands, along with descriptions and examples.



1. Basic String Search
Description: Searches for a specific string in a file and prints the matching lines.
Code:
grep "search_string" [file]
Example: To search for the string "error" in a log file:
Code:
grep "error" /var/log/syslog

2. Case-Insensitive Search
Description: Performs a case-insensitive search by ignoring the case of the search string.
Code:
grep -i "search_string" [file]
Example: To search for "error" or "Error" or "ERROR" in a log file:
Code:
grep -i "error" /var/log/syslog

3. Search Recursively in Directories
Description: Recursively searches through all files in a directory and its subdirectories.
Code:
grep -r "search_string" [directory]
Example: To search for "error" in all files under `/var/log`:
Code:
grep -r "error" /var/log

4. Display Line Numbers with Matches
Description: Displays the line numbers of the matching lines in the output.
Code:
grep -n "search_string" [file]
Example: To search for "error" in a log file and display line numbers:
Code:
grep -n "error" /var/log/syslog

5. Invert Match (Show Non-Matching Lines)
Description: Displays all lines that do not match the search string.
Code:
grep -v "search_string" [file]
Example: To display all lines in a log file that do not contain "error":
Code:
grep -v "error" /var/log/syslog

6. Display Only Matching Parts of Lines
Description: Displays only the parts of lines that match the search string.
Code:
grep -o "search_string" [file]
Example: To display only the word "error" each time it appears in a log file:
Code:
grep -o "error" /var/log/syslog

7. Count the Number of Matches
Description: Counts and displays the number of lines that match the search string.
Code:
grep -c "search_string" [file]
Example: To count how many times "error" appears in a log file:
Code:
grep -c "error" /var/log/syslog

8. Use Extended Regular Expressions (ERE)
Description: Enables extended regular expressions for more advanced pattern matching.
Code:
grep -E "regex_pattern" [file]
Example: To search for lines that contain either "error" or "warning":
Code:
grep -E "error|warning" /var/log/syslog

9. Search for Whole Words Only
Description: Matches only whole words instead of substrings.
Code:
grep -w "search_string" [file]
Example: To search for the whole word "error" but not "errors":
Code:
grep -w "error" /var/log/syslog

10. Show Context Lines (Before and After Matches)
Description: Displays a specified number of lines before and/or after each matching line.
Code:
grep -C [num] "search_string" [file]
grep -B [num] "search_string" [file]
grep -A [num] "search_string" [file]
Example: To show 3 lines before and after each match of "error":
Code:
grep -C 3 "error" /var/log/syslog

11. Suppress Output (Useful for Exit Status Only)
Description: Suppresses all output, useful when you only need to know if a match exists (exit status).
Code:
grep -q "search_string" [file]
Example: To check if "error" exists in a log file without showing output:
Code:
grep -q "error" /var/log/syslog

12. Print Filename with Matches
Description: Displays the name of the file where matches are found, useful when searching multiple files.
Code:
grep -l "search_string" [files]
Example: To find which files in `/var/log` contain "error":
Code:
grep -l "error" /var/log/*

13. Search for Files That Do Not Contain a String
Description: Displays the names of files that do not contain the search string.
Code:
grep -L "search_string" [files]
Example: To find which files in `/var/log` do not contain "error":
Code:
grep -L "error" /var/log/*

14. Search Compressed Files (Using zgrep)
Description: Searches within compressed files, typically using `zgrep` which behaves like `grep` but works with gzip-compressed files.
Code:
zgrep "search_string" [compressed_file]
Example: To search for "error" in a gzip-compressed log file:
Code:
zgrep "error" /var/log/syslog.gz

15. Highlight Matches in Color
Description: Highlights matching strings in color, making them easier to spot in the output.
Code:
grep --color=auto "search_string" [file]
Example: To search for "error" and highlight matches:
Code:
grep --color=auto "error" /var/log/syslog

16. Exclude Specific Files from Search
Description: Excludes certain files from being searched, useful when searching in directories.
Code:
grep --exclude=[file_pattern] "search_string" [directory]
Example: To search for "error" in all files under `/var/log` except `.log` files:
Code:
grep --exclude=*.log "error" /var/log/*

17. Exclude Directories from Recursive Search
Description: Excludes specific directories from being searched when performing a recursive search.
Code:
grep --exclude-dir=[dir_pattern] -r "search_string" [directory]
Example: To search for "error" in `/var/log` but exclude `archive` directory:
Code:
grep --exclude-dir=archive -r "error" /var/log

18. Limit the Number of Matches
Description: Stops searching after a specified number of matches are found.
Code:
grep -m [num] "search_string" [file]
Example: To stop searching after finding the first 5 matches for "error":
Code:
grep -m 5 "error" /var/log/syslog

19. Display Non-Matching Files (In Binary Mode)
Description: Displays files that do not contain matches, useful for binary files.
Code:
grep -L -I "search_string" [files]
Example: To find binary files in `/bin` that do not contain "magic":
Code:
grep -L -I "magic" /bin/*

20. Perform a Binary Search
Description: Searches for matches in binary files and displays them.
Code:
grep -a "search_string" [binary_file]
Example: To search for "magic" in a binary file:
Code:
grep -a "magic" /bin/somebinaryfile



Conclusion

The **grep** command is a powerful tool for searching and filtering text within files and streams, making it an essential utility in the Unix/Linux command-line toolkit. By mastering these commands, you can efficiently search, analyze, and process large amounts of text data.

Happy Searching!

Print this item

  Comprehensive List of FileKill Commands with Descriptions
Posted by: Sneakyone - 09-03-2024, 01:58 AM - Forum: Batch & Shell Scripting - No Replies

Comprehensive List of FileKill Commands with Descriptions

**FileKill** is a command-line utility used to delete files securely or forcefully on Windows systems. It is particularly useful for removing stubborn or locked files that cannot be deleted using standard methods. Below is a detailed list of FileKill commands, along with descriptions and examples.



1. Deleting a Single File
Description: Deletes a specified file.
Code:
filekill.exe [FilePath]
Example: To delete the file `C:\Temp\unwanted.txt`:
Code:
filekill.exe C:\Temp\unwanted.txt

2. Deleting Multiple Files
Description: Deletes multiple files specified by their paths.
Code:
filekill.exe [FilePath1] [FilePath2] ...
Example: To delete `file1.txt`, `file2.txt`, and `file3.txt`:
Code:
filekill.exe C:\Temp\file1.txt C:\Temp\file2.txt C:\Temp\file3.txt

3. Deleting Files in a Directory
Description: Deletes all files within a specified directory.
Code:
filekill.exe [DirectoryPath]\*
Example: To delete all files in `C:\Temp`:
Code:
filekill.exe C:\Temp\*

4. Force Deleting a File
Description: Forcefully deletes a file, even if it is locked or protected.
Code:
filekill.exe -f [FilePath]
Example: To force delete `C:\Temp\lockedfile.txt`:
Code:
filekill.exe -f C:\Temp\lockedfile.txt

5. Secure Deletion (Overwrite Before Deletion)
Description: Securely deletes a file by overwriting it with random data before deletion, making it unrecoverable.
Code:
filekill.exe -s [FilePath]
Example: To securely delete `C:\Temp\sensitivefile.txt`:
Code:
filekill.exe -s C:\Temp\sensitivefile.txt

6. Deleting All Files Matching a Pattern
Description: Deletes all files matching a specific pattern (e.g., all `.txt` files) within a directory.
Code:
filekill.exe [DirectoryPath]\*.extension
Example: To delete all `.log` files in `C:\Logs`:
Code:
filekill.exe C:\Logs\*.log

7. Deleting Read-Only Files
Description: Deletes files even if they are marked as read-only.
Code:
filekill.exe -r [FilePath]
Example: To delete a read-only file `C:\Temp\readonlyfile.txt`:
Code:
filekill.exe -r C:\Temp\readonlyfile.txt

8. Deleting Files Recursively
Description: Deletes files recursively within all subdirectories of a specified directory.
Code:
filekill.exe -R [DirectoryPath]
Example: To delete all files within `C:\Temp` and its subdirectories:
Code:
filekill.exe -R C:\Temp

9. Deleting Empty Files
Description: Deletes files only if they are empty (0 bytes).
Code:
filekill.exe -e [DirectoryPath]\*
Example: To delete all empty files in `C:\Temp`:
Code:
filekill.exe -e C:\Temp\*

10. Deleting Files Without Confirmation
Description: Deletes files without prompting for confirmation.
Code:
filekill.exe -y [FilePath]
Example: To delete `C:\Temp\unwantedfile.txt` without confirmation:
Code:
filekill.exe -y C:\Temp\unwantedfile.txt

11. Deleting Hidden Files
Description: Deletes files even if they are hidden.
Code:
filekill.exe -h [FilePath]
Example: To delete a hidden file `C:\Temp\hiddenfile.txt`:
Code:
filekill.exe -h C:\Temp\hiddenfile.txt

12. Logging Deletion Operations
Description: Logs the details of deletion operations to a specified file.
Code:
filekill.exe -l [LogFilePath] [FilePath]
Example: To delete `C:\Temp\unwantedfile.txt` and log the operation to `C:\Logs\delete.log`:
Code:
filekill.exe -l C:\Logs\delete.log C:\Temp\unwantedfile.txt

13. Deleting System Files
Description: Deletes files that are system-protected. Use this command with caution as it can affect system stability.
Code:
filekill.exe -sys [FilePath]
Example: To delete a system file `C:\Windows\system32\protectedfile.dll`:
Code:
filekill.exe -sys C:\Windows\system32\protectedfile.dll

14. Deleting Files on Next Reboot
Description: Schedules the deletion of a file on the next system reboot, useful for locked files.
Code:
filekill.exe -delayed [FilePath]
Example: To delete `C:\Temp\lockedfile.txt` on the next reboot:
Code:
filekill.exe -delayed C:\Temp\lockedfile.txt

15. Displaying Help Information
Description: Displays the help information for the FileKill command, listing all available options and their descriptions.
Code:
filekill.exe -?
Example: To display help information for FileKill:
Code:
filekill.exe -?



Conclusion

The **FileKill** command is a powerful utility for securely and forcefully deleting files on Windows systems. By mastering these commands, you can efficiently remove stubborn, locked, or protected files, ensuring they are deleted securely and permanently.

Happy Scripting!

Print this item

  Comprehensive List of Extract Commands with Descriptions
Posted by: Sneakyone - 09-03-2024, 01:56 AM - Forum: Batch & Shell Scripting - No Replies

Comprehensive List of Extract Commands with Descriptions

The **Extract** utility is a command-line tool used primarily for extracting files from compressed archives, such as CAB (Cabinet) files, on Windows systems. Below is a detailed list of Extract commands, along with descriptions and examples.



1. Extracting a Single File from a CAB Archive
Description: Extracts a single file from a CAB archive to the current directory.
Code:
extract.exe [CabFile] [FileToExtract]
Example: To extract `example.dll` from `archive.cab`:
Code:
extract.exe archive.cab example.dll

2. Extracting All Files from a CAB Archive
Description: Extracts all files contained in a CAB archive to the current directory.
Code:
extract.exe /e [CabFile]
Example: To extract all files from `archive.cab`:
Code:
extract.exe /e archive.cab

3. Extracting to a Specific Directory
Description: Extracts one or more files from a CAB archive to a specified directory.
Code:
extract.exe /l [DestinationDirectory] [CabFile] [FileToExtract]
Example: To extract `example.dll` from `archive.cab` to `C:\ExtractedFiles`:
Code:
extract.exe /l C:\ExtractedFiles archive.cab example.dll
Note: You can use `/e` instead of specifying a file to extract all files in the archive.

4. Verifying Files in a CAB Archive
Description: Verifies that files in a CAB archive can be extracted without actually extracting them.
Code:
extract.exe /t [CabFile]
Example: To verify the contents of `archive.cab`:
Code:
extract.exe /t archive.cab

5. Displaying a List of Files in a CAB Archive
Description: Lists all files contained within a CAB archive without extracting them.
Code:
extract.exe /d [CabFile]
Example: To display a list of files in `archive.cab`:
Code:
extract.exe /d archive.cab

6. Overwriting Existing Files Without Prompting
Description: Extracts files and overwrites any existing files without prompting the user.
Code:
extract.exe /y [CabFile] [FileToExtract]
Example: To extract `example.dll` from `archive.cab` and overwrite any existing file:
Code:
extract.exe /y archive.cab example.dll

7. Overwriting Specific Files Without Prompting
Description: Overwrites specific files during extraction without prompting, but only those files specified.
Code:
extract.exe /a /y [CabFile] [FileToExtract]
Example: To extract `example.dll` from `archive.cab` and overwrite it if it exists:
Code:
extract.exe /a /y archive.cab example.dll

8. Displaying Help Information
Description: Displays the help information for the Extract command, listing all available options and their descriptions.
Code:
extract.exe /?
Example: To display help information for Extract:
Code:
extract.exe /?

9. Extracting with Confirmation for Overwrites
Description: Extracts files and prompts for confirmation before overwriting existing files.
Code:
extract.exe /r [CabFile] [FileToExtract]
Example: To extract `example.dll` from `archive.cab` and prompt before overwriting:
Code:
extract.exe /r archive.cab example.dll

10. Extracting Files and Preserving File Attributes
Description: Extracts files from a CAB archive while preserving their original file attributes.
Code:
extract.exe /p [CabFile] [FileToExtract]
Example: To extract `example.dll` from `archive.cab` and preserve its attributes:
Code:
extract.exe /p archive.cab example.dll

11. Extracting Files Without Paths
Description: Extracts files from a CAB archive without including their directory paths, placing all files in the specified destination directory.
Code:
extract.exe /f [CabFile] [DestinationDirectory]
Example: To extract all files from `archive.cab` to `C:\ExtractedFiles` without directory structure:
Code:
extract.exe /f archive.cab C:\ExtractedFiles

12. Specifying a Source Directory for Files to Extract
Description: Specifies the source directory within the CAB archive from which to extract files.
Code:
extract.exe /s [SourceDirectory] [CabFile] [FileToExtract]
Example: To extract `example.dll` from the `System32` directory within `archive.cab`:
Code:
extract.exe /s System32 archive.cab example.dll



Conclusion

The **Extract** command is a powerful utility for extracting files from CAB archives and managing compressed data on Windows systems. By mastering these commands, you can efficiently manage and extract files from CAB archives, whether for system recovery, application deployment, or data management.

Happy Scripting!

Print this item

  Comprehensive List of ERUNT Commands with Descriptions
Posted by: Sneakyone - 09-03-2024, 01:55 AM - Forum: Batch & Shell Scripting - No Replies

Comprehensive List of ERUNT Commands with Descriptions

**ERUNT** (Emergency Recovery Utility NT) is a utility for backing up and restoring the Windows Registry. It is particularly useful for creating registry backups that can be restored in case of system failures. Below is a detailed list of ERUNT commands, along with descriptions and examples.



1. Backing Up the Registry
Description: Creates a backup of the entire Windows Registry. By default, the backup is stored in a folder named after the current date.
Code:
erunt.exe [BackupPath]
Example: To back up the registry to `C:\RegBackups`:
Code:
erunt.exe C:\RegBackups
Note: If no path is specified, ERUNT will create a backup in the `C:\WINDOWS\ERDNT` directory by default.

2. Backing Up the Registry with a Custom Folder Name
Description: Creates a registry backup with a custom folder name instead of the default date-based name.
Code:
erunt.exe [BackupPath]\[CustomFolderName]
Example: To back up the registry to `C:\RegBackups\MyBackup`:
Code:
erunt.exe C:\RegBackups\MyBackup

3. Silent Mode Backup
Description: Performs a registry backup without displaying any prompts or confirmation dialogs.
Code:
erunt.exe [BackupPath] /noconfirmdelete /noprogresswindow /days:0
Example: To silently back up the registry to `C:\RegBackups`:
Code:
erunt.exe C:\RegBackups /noconfirmdelete /noprogresswindow /days:0

4. Automated Daily Backup
Description: Configures ERUNT to create daily backups automatically, storing backups in a specified directory.
Code:
erunt.exe [BackupPath] /days:[NumberOfDays]
Example: To set up automated daily backups in `C:\RegBackups` and keep backups for 7 days:
Code:
erunt.exe C:\RegBackups /days:7

5. Restoring the Registry from a Backup
Description: Restores the registry from a previously created backup. The restoration process should be performed from Safe Mode or from outside of Windows.
Code:
erdnt.exe [BackupPath]
Example: To restore the registry from a backup located in `C:\RegBackups\20230902`:
Code:
erdnt.exe C:\RegBackups\20230902

6. Restoring the Registry Silently
Description: Restores the registry without any prompts or user interaction.
Code:
erdnt.exe [BackupPath] /silent
Example: To restore the registry from a backup located in `C:\RegBackups\20230902` without any prompts:
Code:
erdnt.exe C:\RegBackups\20230902 /silent

7. Backing Up Only Specific Parts of the Registry
Description: Allows you to back up only specific registry hives such as `SYSTEM`, `SOFTWARE`, or `DEFAULT`.
Code:
erunt.exe [BackupPath] /registry [hive1] [hive2] ...
Example: To back up only the `SYSTEM` and `SOFTWARE` hives to `C:\RegBackups\PartialBackup`:
Code:
erunt.exe C:\RegBackups\PartialBackup /registry system software

8. Creating a Backup and Including the User Registry
Description: Backs up the entire registry including the user registry hives (`NTUSER.DAT`).
Code:
erunt.exe [BackupPath] /user
Example: To back up the registry including the user registry to `C:\RegBackups`:
Code:
erunt.exe C:\RegBackups /user

9. Restoring the Registry with the User Registry
Description: Restores the entire registry including the user registry hives.
Code:
erdnt.exe [BackupPath] /user
Example: To restore the registry including the user registry from `C:\RegBackups\20230902`:
Code:
erdnt.exe C:\RegBackups\20230902 /user

10. Automating the Backup Process via Task Scheduler
Description: Automates the backup process by scheduling it with Windows Task Scheduler. This is not a direct ERUNT command but can be set up using Task Scheduler.
Code:
schtasks /create /tn "DailyRegistryBackup" /tr "C:\Path\To\erunt.exe C:\RegBackups /noconfirmdelete /noprogresswindow /days:7" /sc daily /st 02:00
Example: To create a daily registry backup at 2 AM:
Code:
schtasks /create /tn "DailyRegistryBackup" /tr "C:\ERUNT\erunt.exe C:\RegBackups /noconfirmdelete /noprogresswindow /days:7" /sc daily /st 02:00



Conclusion

ERUNT is a valuable tool for backing up and restoring the Windows Registry. By using these commands, you can ensure that your system's registry is safely backed up and can be restored in the event of a system issue. Regular backups can prevent significant data loss and simplify recovery processes.

Happy Scripting!

Print this item

  Comprehensive List of DumpHive Commands with Descriptions
Posted by: Sneakyone - 09-03-2024, 01:53 AM - Forum: Batch & Shell Scripting - No Replies

Comprehensive List of DumpHive Commands with Descriptions

**DumpHive** is a command-line utility used to extract and analyze the contents of Windows registry hive files. Below is a detailed list of DumpHive commands, along with descriptions and examples.



1. Dumping a Hive File
Description: Extracts the contents of a specified registry hive file and dumps it into a text file.
Code:
dumphive.exe [HiveFilePath] [OutputFilePath]
Example: To dump the contents of the SYSTEM hive into a text file:
Code:
dumphive.exe C:\Windows\System32\config\SYSTEM C:\output\system_dump.txt

2. Dumping a Specific Key
Description: Extracts the contents of a specific registry key within a hive file.
Code:
dumphive.exe [HiveFilePath] [OutputFilePath] [RegistryKey]
Example: To dump the `HKLM\Software\Microsoft` key from the SOFTWARE hive:
Code:
dumphive.exe C:\Windows\System32\config\SOFTWARE C:\output\microsoft_dump.txt "Microsoft"

3. Displaying Help Information
Description: Displays the help information for the DumpHive command.
Code:
dumphive.exe -h
Example: To display help information for DumpHive:
Code:
dumphive.exe -h

4. Parsing a SAM Hive
Description: Extracts and displays user account information from the SAM (Security Account Manager) hive.
Code:
dumphive.exe C:\Windows\System32\config\SAM C:\output\sam_dump.txt
Example: To extract user account information from the SAM hive:
Code:
dumphive.exe C:\Windows\System32\config\SAM C:\output\sam_dump.txt

5. Extracting Security Descriptors
Description: Extracts and displays the security descriptors from a registry hive.
Code:
dumphive.exe [HiveFilePath] [OutputFilePath] -sd
Example: To extract security descriptors from the SECURITY hive:
Code:
dumphive.exe C:\Windows\System32\config\SECURITY C:\output\security_sd.txt -sd

6. Extracting Last Written Time of Keys
Description: Extracts the last written time of registry keys within a hive.
Code:
dumphive.exe [HiveFilePath] [OutputFilePath] -lastwritten
Example: To extract the last written time for all keys in the SYSTEM hive:
Code:
dumphive.exe C:\Windows\System32\config\SYSTEM C:\output\system_lastwritten.txt -lastwritten

7. Dumping All Subkeys of a Specific Key
Description: Dumps all subkeys of a specific key in a hive to a text file.
Code:
dumphive.exe [HiveFilePath] [OutputFilePath] -subkeys [RegistryKey]
Example: To dump all subkeys under `HKLM\System\CurrentControlSet` in the SYSTEM hive:
Code:
dumphive.exe C:\Windows\System32\config\SYSTEM C:\output\ccs_subkeys.txt -subkeys "CurrentControlSet"

8. Dumping Values Only
Description: Dumps only the values (and not the keys) from a registry hive to a text file.
Code:
dumphive.exe [HiveFilePath] [OutputFilePath] -values
Example: To dump only the values from the SOFTWARE hive:
Code:
dumphive.exe C:\Windows\System32\config\SOFTWARE C:\output\software_values.txt -values

9. Extracting Data in Hexadecimal Format
Description: Extracts and displays the data from the registry hive in hexadecimal format.
Code:
dumphive.exe [HiveFilePath] [OutputFilePath] -hex
Example: To extract data from the SYSTEM hive in hexadecimal format:
Code:
dumphive.exe C:\Windows\System32\config\SYSTEM C:\output\system_hex.txt -hex

10. Extracting Binary Data from Registry Values
Description: Extracts binary data from specific registry values within a hive.
Code:
dumphive.exe [HiveFilePath] [OutputFilePath] -binary [RegistryKey] [ValueName]
Example: To extract binary data from the `HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters` key:
Code:
dumphive.exe C:\Windows\System32\config\SYSTEM C:\output\tcpip_parameters.bin -binary "Tcpip\Parameters" "BinaryValueName"



Conclusion

DumpHive is a powerful tool for extracting and analyzing the contents of Windows registry hive files. By mastering these commands, you can efficiently gather important information from registry hives for forensic analysis or system administration purposes.

Happy Scripting!

Print this item