Check back, I update site often.
Best viewed on regular computer screen
(i.e. not so good on smartphones)
I have collected a varied set of batch codes to do things so I am sharing them here. Currently they are in no particular order. I figured some of them out on my own and some I got from other web pages.
Most if not all of these batch files will work with current versions of Windows.
Use at your own risk.
In Tools/Options/Mail Format: users click: "Editor Options..." "Spelling and Autocorrect..." "Signatures..." or "Stationary and Fonts..." and nothing happens. The button is active and not greyed out.
Solution:
Empty your temp internet files and if it still fails, change BOTH (Default) and LocalServer32 values in each of the following keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0006F03A-0000-0000-C000-000000000046}\LocalServer32
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0006F03A-0000-0000-C000-000000000046}\LocalServer32
To:
[find the location of the Outlook program file] examples:
For Outlook 2010: "C:\Program Files (x86)\Microsoft Office\Office14\Outlook.exe"
For Outlook 2013: "C:\Program Files (x86)\Microsoft Office\Office15\Outlook.exe"
For Outlook 0365: "C:\Program Files\Microsoft Office\root\Office16\Outlook.exe"
http:superuser.com/questions/950435/ddg#950457
Correct link is:
%windir%\explorer.exe shell:Appsfolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge
Then add it's icon from its own .exe if you don't like the default look.
%windir%\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe
To create a shortcut to open to a spicific web page:
%windir%\explorer.exe microsoft-edge:http://www.yoursite.com
In this example the files are copied to the XXXX drive. Change XXX to fit your particular situation. (Use Replace... to change XXXX to the drive you want to back up to.)
@ECHO OFF COLOR F7 @ECHO. @ECHO ****************************************************** @ECHO. @ECHO This program uses robocopy to copy only the folders @ECHO My Documents, Desktop, Favories, and Pictures of the @ECHO current user [ %USERNAME% ] to drive XXXX. @ECHO. @ECHO ****************************************************** @ECHO. @ECHO. @ECHO To abort, exit this window with the X in the upper right hand corner, else... @ECHO. pause @ECHO. @ECHO. @ECHO Are you sure? @ECHO. @ECHO. @ECHO To abort, exit this window with the X in the upper right hand corner, else... @ECHO. @ECHO. pause cls SET $FOLDERSCOPIED= IF EXIST XXXX:\Backup.log DEL XXXX:\Backup.log set $FOLDER=Documents SET $SUBRETURN=$RETURN1 GOTO $SUBROUTINE1 :$RETURN1 set $FOLDER=Favorites SET $SUBRETURN=$RETURN2 GOTO $SUBROUTINE1 :$RETURN2 set $FOLDER=Desktop SET $SUBRETURN=$RETURN3 GOTO $SUBROUTINE1 :$RETURN3 set $FOLDER=Pictures SET $SUBRETURN=$RETURN4 GOTO $SUBROUTINE1 :$RETURN4 goto END REM * Start Subroutine 1--------------------------------------------------------- :$SUBROUTINE1 @ECHO. @ECHO Copying %username%'s %$FOLDER% folder to XXXX drive. set $SOURCEFOLDER=%USERPROFILE%\%$FOLDER% set $DESTFOLDER=XXXX:\%USERNAME%\%$FOLDER% ROBOCOPY %$SOURCEFOLDER% %$DESTFOLDER% /Z /FFT /MIR /R:0 /R:0 /W:0 /log+:XXXX:\Backup.log /V SET $FOLDERSCOPIED=%$FOLDERSCOPIED% %$FOLDER%, cls GOTO %$SUBRETURN% REM * End Subroutine 1------------------------------------------------------------ :END @ECHO. @ECHO Profile %USERNAME% folders %$FOLDERSCOPIED% copied to XXXX drive. @ECHO. @ECHO Program finished. @ECHO. pause exit
You can change the boot to safemode using MSConfig. However, if you can't boot into Windows, or your windows won't keep working long enough to start MSConfig, you can interupt the startup about three times and the computer will boot to a diagnostic mode.
Go through the menus and choose to go to the command prompt.
Syntax: * bcdedit /set {default} safeboot
Type in the command prompt exactly as indicated, including the brackets, then press ENTER:
Modes:
* Safe Mode:
bcdedit /set {default} safeboot minimal
* Safe Mode with Networking:
bcdedit /set {default} safeboot network
* Safe Mode with Command Prompt:
bcdedit /set {default} safeboot minimal
bcdedit /set {default} safebootalternateshell yes
I found this at:
https://community.spiceworks.com/how_to/94471-how-to-reboot-into-safe-mode-at-a-command-prompt
Find the app's AppUserModelID from the Registry.
Use the the following syntax at the command line or in a batch file.
explorer.exe shell:appsFolder\AppUserModelID
Example for the APP Pandora:
I searched the Registry for 'Pandora' until I found this:
[HKEY_CLASSES_ROOT\AppXwv0gcxhfzc1wz3q9j596bfk9ths12een\Application]
"ApplicationName"="Pandora" "ApplicationCompany"="Pandora Media Inc" "ApplicationIcon"="@{PandoraMediaInc.29680B314EFC2_13.0.39.0_x64__n619g4d5j0fnw?ms-resource://PandoraMediaInc.29680B314EFC2/Files/images/Square44x44Logo.png}" "ApplicationDescription"="PandoraUWP" "AppUserModelID"="PandoraMediaInc.29680B314EFC2_n619g4d5j0fnw!App"
Therefore the command line to run Pandora is this:
explorer.exe shell:appsFolder\PandoraMediaInc.29680B314EFC2_n619g4d5j0fnw!App
Put this code at the beginning of the batch file
C:\>PowerShell.exe -NoLogo -NoProfile -WindowStyle Hidden -Command exit
Save this one line of text as file invisible.vbs:
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
To run any program or batch file invisibly, use it like this:
wscript.exe "C:\Wherever\invisible.vbs" "C:\Some Other Place\MyBatchFile.bat"
You must put full path to Invisible.vbs, and you must surround that and the batch file location in double quotes.
To pass-on/relay a list of arguments use only two double quotes …
This was found at:
https://superuser.com/questions/62525/run-a-batch-file-in-a-completely-hidden-way#62646Put this code at the beginning of the batch file
PowerShell.exe -WindowStyle Minimize -Command exit
C:\>PowerShell.exe -NoLogo -NoProfile -WindowStyle Maximize -Command exit
C:\>PowerShell.exe -NoLogo -NoProfile -WindowStyle Normal -Command exit
There is a quite interesting way to execute script minimized by making him restart itself minimised. Here is the code to put in the beginning of your script:
if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start "" /min "%~dpnx0" %* && exit
... script logic here ...
exit
How it works
When the script is being executed IS_MINIMIZED
is not defined (if not
DEFINED IS_MINIMIZED
) so:
IS_MINIMIZED
is set to 1
: set IS_MINIMIZED=1
.
Script starts a copy of itself using start command
&& start "" /min "%~dpnx0" %*
where:
""
- empty title for the window.
/min
- switch to run minimized.
"%~dpnx0"
- full path to your script.
%*
- passing through all your script's parameters.
Then initial script finishes its work: && exit
.
For the started copy of the script variable IS_MINIMISED
is set by the original script so it just
skips the execution of the first line and goes directly to the script logic.
Remarks
You have to reserve some variable name to use it as a flag.
The script should be ended with exit, otherwise
the cmd window wouldn't be closed after the script execution.
If your script doesn't accept arguments you could use argument as a flag instead of variable:
if "%1" == "" start "" /min "%~dpnx0" MY_FLAG && exit
Below is an example of how to delay a batch file any where from 5 to 99 seconds. In the below example we illustrate a 5 second delay.
TYPE NUL | CHOICE.COM /N /CY /TY,5 >NUL
TIMEOUT [/T] timeout [/NOBREAK]
Description:
This utility accepts a timeout parameter to wait for the specified
time period (in
seconds) or until any key is pressed. It also
accepts a parameter to ignore the key press.
Parameter List:
/T timeout
Specifies the number of seconds to wait.
Valid range is -1 to 99999 seconds.
/NOBREAK
Ignore key presses and wait specified time.
/?
Displays this help message.
NOTE: A timeout value of -1 means to wait indefinitely for a key press.
Examples:
TIMEOUT /?
TIMEOUT /T 10
TIMEOUT /T 300 /NOBREAK
TIMEOUT /T -1
Current User
"C:\Users\[User logon name here]\AppData\Roaming\Microsoft\Windows\Start Menu"
OR
"%homepath%\AppData\Roaming\Microsoft\Windows\Start Menu"
---
Example:
C:\Users\7\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
is the path to my start menu, programs folder (Example user account is called "7")
Of course that is for THAT user.
---
All Users is in a slightly different location:
C:\Users\All Users\Microsoft\Windows\Start Menu\Programs
set /p input=enter your name:
Would prompt
enter your name:
with the curser after name:
set var2=%var:~x,y%
Where VAR
can be any variable name.
Where X
=offset (how many spaces to skip)
Where y
=characters to view.
If y
is possitive it counts from the beginning.
If y
is negative it counts from
the end of the variable.
:: The variables for the day of week are: :: Mon Tue Wed Thu Fri Sat Sun set day=Thu set dayok= date /T | find "%day%" > nul if NOT ERRORLEVEL 1 set dayok=yes
:: Variable (%~1) is the variable to change to Lower Case
:LoCase
:: Subroutine to convert a variable VALUE to all lower case.
:: The argument for this subroutine is the variable NAME.
SET %~1=!%1:A=a! SET %~1=!%1:B=b! SET %~1=!%1:C=c! SET %~1=!%1:D=d! SET %~1=!%1:E=e! SET %~1=!%1:F=f! SET %~1=!%1:G=g! SET %~1=!%1:H=h! SET %~1=!%1:I=i! SET %~1=!%1:J=j! SET %~1=!%1:K=k! SET %~1=!%1:L=l! SET %~1=!%1:M=m! SET %~1=!%1:N=n! SET %~1=!%1:O=o! SET %~1=!%1:P=p! SET %~1=!%1:Q=q! SET %~1=!%1:R=r! SET %~1=!%1:S=s! SET %~1=!%1:T=t! SET %~1=!%1:U=u! SET %~1=!%1:V=v! SET %~1=!%1:W=w! SET %~1=!%1:X=x! SET %~1=!%1:Y=y! SET %~1=!%1:Z=z!
@echo off @echo. @echo. date /T | find "Sun" > nul if NOT ERRORLEVEL 1 set day=Sunday if NOT ERRORLEVEL 1 goto foundit date /T | find "Mon" > nul if NOT ERRORLEVEL 1 set day=Monday if NOT ERRORLEVEL 1 goto foundit date /T | find "Tue" > nul if NOT ERRORLEVEL 1 set day=Tuesday if NOT ERRORLEVEL 1 goto foundit date /T | find "Wed" > nul if NOT ERRORLEVEL 1 set day=Wendsday if NOT ERRORLEVEL 1 goto foundit date /T | find "Thr" > nul if NOT ERRORLEVEL 1 set day=Thursday if NOT ERRORLEVEL 1 goto foundit date /T | find "Fri" > nul if NOT ERRORLEVEL 1 set day=Friday if NOT ERRORLEVEL 1 goto foundit date /T | find "Sat" > nul if NOT ERRORLEVEL 1 set day=Saturday if NOT ERRORLEVEL 1 goto foundit :foundit @echo. @echo It is %day%! @echo. @echo. :quit
:: curdir.bat @SET cd= @SET promp$=%prompt% @PROMPT SET cd$Q$P @CALL>%temp%.\setdir.bat @ % do not delete this line % @ECHO off PROMPT %promp$% FOR %%c IN (CALL DEL) DO %%c %temp%.\setdir.bat ECHO. current directory=%cd%
goto endsubs :sub1 :: Enter subroutine here goto %return% :endsubs :: Call Subroutine with this. set return=ret1 goto sub1 :ret1
%command:~[Starting Character],[number of characters to grab]%
How it works:
Must start with %
First word is the command you are extracting the output data.
That command if
followed by :~
Next is the location of the first (left most) character you want to extract from the output
of the command.
(The count starts with zero not one. If you use a negative number the count starts at the
right.)
Next a Comma
Next the number of characters you want to extract
End with %
REM Adding leading 0 to hour if hour under 10... set $a=%time:~0,1% set $hour=%time:~0,2% if "%$a%"==" " set $hour=0%time:~1,1% set $min=%time:~3,2% set $sec=%time:~6,2% set $milsec=%time:~9,2% set $year=%date:~10,4% set $month=%date:~4,2% set $day=%date:~7,2% set $dayname=%date:~0,3% SET $XDate=%$year%-%$month%-%$day%-%$dayname% SET $XTime=%$hour%.%$min%.%$sec%.%$milsec% set $newdirectory=%$directory%%$Xdate% %$XTime% @echo. @echo Creating Directory: %$newdirectory% @echo.
You can execute this batch file so that every time it creates a new folder that is unique to the date and time when it was created, thus not deleting the previous folder.
@echo off GOTO archive-skip archive.cmd Created by Daniel Jacobson Last Updated 09/14/2019 This batch program was created to be used for incremental backups of files. Variables $file = File to be backed up $directory = directory for backup folder/file $year = current year $month = curent month $day = current day $dayname = current name of day $XDate = current date $a = used to test if hour had a leading zero $hour = current hour $min = current minute $sec = current sec $milsec = current milisecond $XTime = current time $file = File to be archived $Directory = Directory the newly created folder is to be created in. $newdirectory = compleate path & name for new directory. REM ----------------------------------------- :archive-skip REM *************Start************** %echo on REM Set Variables set $file= set $directory= REM Test Variables REM Testing first variable if %1'==' goto syntax if not exist %1 goto syntax1 set $file=%~1 REM Testing second variable if %2'==' goto nodirectory set $directory=%~2\ goto dirok :nodirectory REM Make target directory for sub directory same as directory file is in. set $directory=%~dp1 :dirok GOTO archive-skip1 -------------------------------- How date and time are extracted: Make Directory With Name Date and Time Old Way: for /f "tokens=1-4 delims=/- " %%a in ('date /t') do set $XDate=%%d-%%b-%%c %%a for /f "tokens=1-2 delims=: " %%a in ('time /t') do set $XTime=%%a.%%b How the below code for extracting the date and time works: %command:~[Starting Character],[number of characters to grab]% Must start with % First word is the command you are extracting the information. That command if followed by :~ Next is the first character you want to extract A negative number starts the count from the left The count starts with 0 not 1 Next a Comma , Next the number of characters you want to extract End with % However there is a problem with no leading zero (0) if the hour is under 10. The following 3 lines of code adds the zero. set a=%time:~0,1% set $hour=%time:~0,2% if "%a%"==" " set $hour=0%time:~1,1% -------------------------------- :archive-skip1 set $a=%time:~0,1% set $hour=%time:~0,2% if "%$a%"==" " set $hour=0%time:~1,1% set $min=%time:~3,2% set $sec=%time:~6,2% set $milsec=%time:~9,2% set $year=%date:~10,4% set $month=%date:~4,2% set $day=%date:~7,2% set $dayname=%date:~0,3% SET $XDate=%$year%-%$month%-%$day%-%$dayname% SET $XTime=%$hour%.%$min%.%$sec%.%$milsec% set $newdirectory=%$directory%%$Xdate% %$XTime% @echo. @echo Creating Directory: %$newdirectory% @echo. md "%$newdirectory%" REM Copying file to created directory @echo. @echo Copying "%$file%" to "%$newdirectory%" @echo. xcopy /v /z "%$file%" "%$newdirectory%" @echo. goto EOF REM ------------------------------------- REM End Messages :syntax1 @echo. @echo The filename entered does not exist. @echo. :syntax @echo. @echo Archive @echo. @echo Copies file(s) to folders that are named the current time and date. @echo. @echo Syntax: ARCHIVE filename directory @echo. @echo filename = The file to be archived. @echo. @echo note: If no file is specified, all files in folder are copied. @echo. @echo Directory = Location where you want the new folder to be created. @echo. @echo note: If no directory is listed, then folder is created in the @echo same directory as file is found. :EOF
This is for installing a program from a network or thumb drive. It will delete the destination folder and
then install the program. Of course you can modify it to change what it does.
Create a folder with the name of the program to be installed Program
and put this batch file in
it. Then a subfolder called Install
in that folder, and another folder called Shortcut
in the 'install' folder.
Folders to create:
Program/Install/Shortcut
---
@echo off CLS :: :: :: This program installs a folder and a file and an icon. :: It is a generic install program designed to install programs using :: a batch file. :: :: This program is set only to be run as a subroutine. :: :: @echo. @echo. @echo This program will install {put the name of your program here}. @echo. @echo Program can be accesed via a Start Menu shortcut under {Location of sortcut in start menu here}. @echo. @echo. @echo. @echo To abort, exit this window with the X in the upper right hand corner, else... @echo. @echo. pause @echo. @echo. @echo Are you sure? @echo. @echo. @echo To abort, exit this window with the X in the upper right hand corner, else... @echo. @echo. pause cls SETLOCAL Set THISDIR=%~dp0 :: Sourcefolder = folder you wish to copy from. set sourcefolder=%THISDIR%Install\{Name of install program here} :: destfolder is the destination you wish to put the sourcefolder. set destfolder=%PROGRAMFILES%\DAJWare\{Name of install program here} :: Shortcut is the location of the shortcut set shortcut=%THISDIR%Install\Shortcut\*.lnk :: shortcutdest = is where you want the shortcut to be installed. set shortcutdest=%ALLUSERSPROFILE%\Start Menu\Programs\Accessories\System Tools :: Shortcut is the location of the Startup shortcut set Startup=%THISDIR%Install\Startup\*.lnk :: shortcutdest = is where you want the shortcut to be installed. set Startupdest=%ALLUSERSPROFILE%\Start Menu\Programs\Startup :: Checking if program folder already exists, if it then delete it. if not exist "%destfolder%" goto :skip1 del /F /S /Q "%destfolder%\*.*" rd /Q /s "%destfolder%" :Skip1 ROBOCOPY /E /zB "%sourcefolder%" "%destfolder%" ROBOCOPY /E /zB "%shortcut%" "%shortcutdest%" ROBOCOPY /E /zB "%Startup%" "%Startupdest%" :ENDPROGRAM rem start "Edit" NOTEPAD.EXE "C:\Program Files\DAJWare\Defrag\DefragFixedDrives.bat" @echo. @echo Program end @echo. @echo To close this dialog... @echo. REM PAUSE exit
rundll32.exe user32.dll, LockWorkStation
shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/fw] [/f]
[/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]
Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/fw] [/f] [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]] No args Display help. This is the same as typing /?. /? Display help. This is the same as not typing any options. /i Display the graphical user interface (GUI). This must be the first option. /l Log off. This cannot be used with /m or /d options. /s Shutdown the computer. /r Full shutdown and restart the computer. /g Full shutdown and restart the computer. After the system is rebooted, restart any registered applications. /a Abort a system shutdown. This can only be used during the time-out period. Combine with /fw to clear any pending boots to firmware. /p Turn off the local computer with no time-out or warning. Can be used with /d and /f options. /h Hibernate the local computer. Can be used with the /f option. /hybrid Performs a shutdown of the computer and prepares it for fast startup. Must be used with /s option. /fw Combine with a shutdown option to cause the next boot to go to the firmware user interface. /e Document the reason for an unexpected shutdown of a computer. /o Go to the advanced boot options menu and restart the computer. Must be used with /r option. /m \\computer Specify the target computer. /t xxx Set the time-out period before shutdown to xxx seconds. The valid range is 0-315360000 (10 years), with a default of 30. If the timeout period is greater than 0, the /f parameter is implied. /c "comment" Comment on the reason for the restart or shutdown. Maximum of 512 characters allowed. /f Force running applications to close without forewarning users. The /f parameter is implied when a value greater than 0 is specified for the /t parameter. /d [p|u:]xx:yy Provide the reason for the restart or shutdown. p indicates that the restart or shutdown is planned. u indicates that the reason is user defined. If neither p nor u is specified the restart or shutdown is unplanned. xx is the major reason number (positive integer less than 256). yy is the minor reason number (positive integer less than 65536). Reasons on this computer: (E = Expected U = Unexpected P = planned, C = customer defined) Type Major Minor Title U 0 0 Other (Unplanned) E 0 0 Other (Unplanned) E P 0 0 Other (Planned) U 0 5 Other Failure: System Unresponsive E 1 1 Hardware: Maintenance (Unplanned) E P 1 1 Hardware: Maintenance (Planned) E 1 2 Hardware: Installation (Unplanned) E P 1 2 Hardware: Installation (Planned) E 2 2 Operating System: Recovery (Unplanned) E P 2 2 Operating System: Recovery (Planned) P 2 3 Operating System: Upgrade (Planned) E 2 4 Operating System: Reconfiguration (Unplanned) E P 2 4 Operating System: Reconfiguration (Planned) P 2 16 Operating System: Service pack (Planned) 2 17 Operating System: Hot fix (Unplanned) P 2 17 Operating System: Hot fix (Planned) 2 18 Operating System: Security fix (Unplanned) P 2 18 Operating System: Security fix (Planned) E 4 1 Application: Maintenance (Unplanned) E P 4 1 Application: Maintenance (Planned) E P 4 2 Application: Installation (Planned) E 4 5 Application: Unresponsive E 4 6 Application: Unstable U 5 15 System Failure: Stop error U 5 19 Security issue (Unplanned) E 5 19 Security issue (Unplanned) E P 5 19 Security issue (Planned) E 5 20 Loss of network connectivity (Unplanned) U 6 11 Power Failure: Cord Unplugged U 6 12 Power Failure: Environment P 7 0 Legacy API shutdown
:: CURDRIVE.BAT :: Written by Rob van der Woude :: Places the current drive letter in environment variable CURRDRIVE :: SET CURDRIVE= CD | CHOICE /C:ABCDEFGHIJKLMNOPQRSTUVWXYZ > NUL IF ERRORLEVEL 1 SET CURDRIVE=A IF ERRORLEVEL 2 SET CURDRIVE=B IF ERRORLEVEL 3 SET CURDRIVE=C IF ERRORLEVEL 4 SET CURDRIVE=D IF ERRORLEVEL 5 SET CURDRIVE=E IF ERRORLEVEL 6 SET CURDRIVE=F IF ERRORLEVEL 7 SET CURDRIVE=G IF ERRORLEVEL 8 SET CURDRIVE=H IF ERRORLEVEL 9 SET CURDRIVE=I IF ERRORLEVEL 10 SET CURDRIVE=J IF ERRORLEVEL 11 SET CURDRIVE=K IF ERRORLEVEL 12 SET CURDRIVE=L IF ERRORLEVEL 13 SET CURDRIVE=M IF ERRORLEVEL 14 SET CURDRIVE=N IF ERRORLEVEL 15 SET CURDRIVE=O IF ERRORLEVEL 16 SET CURDRIVE=P IF ERRORLEVEL 17 SET CURDRIVE=Q IF ERRORLEVEL 18 SET CURDRIVE=R IF ERRORLEVEL 19 SET CURDRIVE=S IF ERRORLEVEL 20 SET CURDRIVE=T IF ERRORLEVEL 21 SET CURDRIVE=U IF ERRORLEVEL 22 SET CURDRIVE=V IF ERRORLEVEL 23 SET CURDRIVE=W IF ERRORLEVEL 24 SET CURDRIVE=X IF ERRORLEVEL 25 SET CURDRIVE=Y IF ERRORLEVEL 26 SET CURDRIVE=Z IF "%CURDRIVE%"=="" ECHO Error checking current drive IF NOT "%CURDRIVE%"=="" ECHO Current drive is %CURDRIVE%:
%SystemRoot%\System32\logoff.exe
TASKKILL [/S system [/U username [/P [password]]]]
{ [/FI filter] [/PID processid | /IM imagename] } [/T] [/F]
TASKKILL [/S system [/U username [/P [password]]]]
{ [/FI filter] [/PID processid | /IM imagename] } [/T] [/F]
Description:
This tool is used to terminate tasks by process id (PID) or image name.
Parameter List:
/S system Specifies the remote system to connect to.
/U [domain\]user Specifies the user context under which the
command should execute.
/P [password] Specifies the password for the given user
context. Prompts for input if omitted.
/FI filter Applies a filter to select a set of tasks.
Allows "*" to be used. ex. imagename eq acme*
/PID processid Specifies the PID of the process to be terminated.
Use TaskList to get the PID.
/IM imagename Specifies the image name of the process
to be terminated. Wildcard '*' can be used
to specify all tasks or image names.
/T Terminates the specified process and any
child processes which were started by it.
/F Specifies to forcefully terminate the process(es).
/? Displays this help message.
Filters:
Filter Name Valid Operators Valid Value(s)
----------- --------------- -------------------------
STATUS eq, ne RUNNING |
NOT RESPONDING | UNKNOWN
IMAGENAME eq, ne Image name
PID eq, ne, gt, lt, ge, le PID value
SESSION eq, ne, gt, lt, ge, le Session number.
CPUTIME eq, ne, gt, lt, ge, le CPU time in the format
of hh:mm:ss.
hh - hours,
mm - minutes, ss - seconds
MEMUSAGE eq, ne, gt, lt, ge, le Memory usage in KB
USERNAME eq, ne User name in [domain\]user
format
MODULES eq, ne DLL name
SERVICES eq, ne Service name
WINDOWTITLE eq, ne Window title
NOTE
----
1) Wildcard '*' for /IM switch is accepted only when a filter is applied.
2) Termination of remote processes will always be done forcefully (/F).
3) "WINDOWTITLE" and "STATUS" filters are not considered when a remote
machine is specified.
Examples:
TASKKILL /IM notepad.exe
TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
TASKKILL /F /IM cmd.exe /T
TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM notepad.exe
TASKKILL /S system /U domain\username /FI "USERNAME ne NT*" /IM *
TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"
WhoAmI has three ways of working: Syntax 1: WHOAMI [/UPN | /FQDN | /LOGONID] Syntax 2: WHOAMI { [/USER] [/GROUPS] [/CLAIMS] [/PRIV] } [/FO format] [/NH] Syntax 3: WHOAMI /ALL [/FO format] [/NH] Description: This utility can be used to get user name and group information along with the respective security identifiers (SID), claims, privileges, logon identifier (logon ID) for the current user on the local system. I.e. who is the current logged on user? If no switch is specified, tool displays the user name in NTLM format (domain\username). Parameter List: /UPN Displays the user name in User Principal Name (UPN) format. /FQDN Displays the user name in Fully Qualified Distinguished Name (FQDN) format. /USER Displays information on the current user along with the security identifier (SID). /GROUPS Displays group membership for current user, type of account, security identifiers (SID) and attributes. /CLAIMS Displays claims for current user, including claim name, flags, type and values. /PRIV Displays security privileges of the current user. /LOGONID Displays the logon ID of the current user. /ALL Displays the current user name, groups belonged to along with the security identifiers (SID), claims and privileges for the current user access token. /FO format Specifies the output format to be displayed. Valid values are TABLE, LIST, CSV. Column headings are not displayed with CSV format. Default format is TABLE. /NH Specifies that the column header should not be displayed in the output. This is valid only for TABLE and CSV formats. /? Displays this help message. Examples: WHOAMI WHOAMI /UPN WHOAMI /FQDN WHOAMI /LOGONID WHOAMI /USER WHOAMI /USER /FO LIST WHOAMI /USER /FO CSV WHOAMI /GROUPS WHOAMI /GROUPS /FO CSV /NH WHOAMI /CLAIMS WHOAMI /CLAIMS /FO LIST WHOAMI /PRIV WHOAMI /PRIV /FO TABLE WHOAMI /USER /GROUPS WHOAMI /USER /GROUPS /CLAIMS /PRIV WHOAMI /ALL WHOAMI /ALL /FO LIST WHOAMI /ALL /FO CSV /NH WHOAMI /?
This batch file is to adjust the system volume from the command line or from a batch file. You can use a program called nircmd.exe found at http://www.nirsoft.net/utils/nircmd.html. I created the below batch file to make using the nircmd.exe easier to use. With this you only have to type systole and then the number of the percentage you want to set the system volume to. I called the below program sysvol.cmd. I downloaded the nircmd.exe from the web site and but all the files in the windows system32 folder. However it is a batch file so you must use the call command to access it from a batch file unless it is the last command in the batch file. Otherwise the remaining commands in the batch file will not execute.
@echo off :: :: sysvol.cmd :: :: Created by Daniel Jacobson :: :: Created 8/19/2016 :: :: This program requires the program nircmd.exe. :: :: nircmd.exe be downloaded at: http://www.nirsoft.net/utils/nircmd.html :: :: Clearing Variables Set $X= SET $LEV= :: This filters the input to only 0 through 100 :: %1 is the value that is entered after the sysvol command: sysvol X if %1'==' goto Syntax if %1 LSS 0 goto Syntax if %1 GTR 100 goto Syntax :: 100% = 65535 :: 75%= 49151.25 :: 50%= 32767.5 :: 25%= 16383.75 :: Calculating persentage to a value nircmd.exe can understand. set /a "$X=%1*65535" set /A "$LEV=$X/100" @echo. @echo Set Windows System Volume to %1%%% @echo. nircmd.exe setsysvolume %$LEV% goto end :syntax @echo. @echo sysvol [n] @echo. @echo Sets the system volume to the percent you specify from 0%% to 100%%. @echo. @echo n = Any positive number from 0 to 100. @echo (Do not use the percent %% sign.) @echo. :end :: Clearing Variables Set $X= SET $LEV=
@echo off :: Created by Daniel Jacobson :: Last Updated 10-11-2015 :: :: This program deletes the standard Windows temporary files. :: This was written for Windows Windows version 5, 6, and 10. :: Not recomended on any other OS. :: :: :: With Windows 10 it must be run from a shortcut that has administrator privilages. :: :: Windows XP - 5.1 :: Windows XP Pro - 5.2 :: Windows Vista - 6.0 :: Windows 7 - 6.1 :: Windows 8 - 6.2 :: Windows 8.1 - 6.3 :: Windows 10 - 10 :: :: @echo. @echo This program deletes the standard Windows temporary files. @echo. @echo. @echo *********************************************************************** @echo * * @echo * This has been tested on Windows Version XP, VISTA, 7, 8, and 10 only. * @echo * * @Echo * Not recomended on any other OS. * @echo * * @echo * The OS on this PC is: * ver @echo * * @echo *********************************************************************** @echo. @echo. @echo To abort, exit this window with the X in the upper right hand corner, else... @echo. @echo. pause @echo. @echo. @echo Are you sure? @echo. @echo. @echo To abort, exit this window with the X in the upper right hand corner, else... @echo. @echo. pause @echo. @echo. @echo DELETE WINDOWS TEMPORARY FILES PROGRAM @echo. @echo %date% %time% @echo. @echo This program will delete standard windows temporary @echo files on this computer for the current user. @echo. @echo ------------------------------------------------------ GOTO OSOK :: Testing for Windows Version. ver | find "Version 5" > nul if NOT ERRORLEVEL 1 goto :OSOK ver | find "Version 6" > nul if NOT ERRORLEVEL 1 goto :OSOK ver | find "Version 10" > nul if NOT ERRORLEVEL 1 goto :OSOK @ECHO. @ECHO Wrong Windows Version @ECHO. @ECHO As of July 2011 @echo. @ECHO This program only works on Windows Versions 5 and 6. @echo. @echo Your version is version: ver @echo. GOTO :ENDPROGRAM :OSOK :: Delete files in the %temp% directory. set lastfive=%temp:~-5% IF /i "%temp%"=="" ( @echo. @Echo %%temp%% variable is does not exist. @echo. @echo %%temp%% Variable needs to be set on this PC. @echo. @echo This program is halted. @echo. pause goto :ENDPROGRAM ) if /i "%lastfive%"=="\temp" ( SET DESC=Temporary files in the %%temp%% Directory. SET TARGET=%temp% SET FILEORDIR=DIR call :DELFILES ) ELSE ( @echo. @echo %%temp%% variable = %temp% @echo. @echo %%temp%% variable does not end in \temp @echo. @echo Not taking any chances, not deleteing files. @echo. @echo Recomend changing %%temp%% variable. @echo. @echo This program is halted. @echo. @echo %date% %time% @echo. pause goto :ENDPROGRAM ) ) :: The following works in Windows versions 5 and 6 SET DESC=Temporary files in System Root directory. SET TARGET=%SYSTEMROOT%\temp SET FILEORDIR=DIR call :DELFILES SET DESC=Temp files root of the Home Drive. SET TARGET=%homedrive%\temp SET FILEORDIR=DIR call :DELFILES ver | find "Version 5" > nul if ERRORLEVEL 1 goto :NOTOS5 :: This is for Windows Version 5 SET DESC=Temporary Internet Files of Current user. SET TARGET=%HOMEDRIVE%%homepath%\Local Settings\Temporary Internet Files SET FILEORDIR=DIR call :DELFILES :NOTOS5 ver | find "Version 6" > nul if ERRORLEVEL 1 goto :NOTOS6 :: This is for Windows Version 6. SET DESC=Temporary Internet Files of Current user. SET TARGET=%HOMEDRIVE%%homepath%\AppData\Local\Microsoft\Windows\Temporary Internet Files SET FILEORDIR=DIR call :DELFILES :NOTOS6 ver | find "Version 10" > nul if ERRORLEVEL 1 goto :NOTOS10 :: This is for Windows Version 10. SET DESC=Temporary Internet Files of Current user. SET TARGET=%HOMEDRIVE%%homepath%\AppData\Local\Microsoft\Windows\INetCache SET FILEORDIR=DIR call :DELFILES :NOTOS10 GOTO :ENDPROGRAM :: Subroutines :DELFILES @ECHO. IF %FILEORDIR%==DIR ( if not exist "%TARGET%" echo * if not exist "%TARGET%" echo * %DESC% if not exist "%TARGET%" echo * if not exist "%TARGET%" echo * %TARGET% if not exist "%TARGET%" echo * if not exist "%TARGET%" echo * [DIRECTORY NOT FOUND] if not exist "%TARGET%" echo * if not exist "%TARGET%" goto :ENDDEL @echo * @echo * Deleting %DESC% @echo * @echo * Target=%TARGET% @echo * @echo. echo y| cacls "%TARGET%/*.*" /T /C /G EVERYONE:F SYSTEM:F attrib /S /D -r -a -s -h "%TARGET%\*.*" del /F /S /Q "%TARGET%\*.*" if exist "%TARGET%\*.*" ( echo y| cacls "%TARGET%" /T /C /G EVERYONE:F SYSTEM:F rd /S /Q "%TARGET%" md "%TARGET%" ) goto :ENDDEL ) IF %FILEORDIR%==FILE ( if not exist "%TARGET%" echo * if not exist "%TARGET%" echo * %DESC% if not exist "%TARGET%" echo * if not exist "%TARGET%" echo * %TARGET% if not exist "%TARGET%" echo * if not exist "%TARGET%" echo * [FILE NOT FOUND] if not exist "%TARGET%" echo * if not exist "%TARGET%" goto :ENDDEL @echo * @echo * Deleting %DESC% @echo * @echo * Target=%TARGET% @echo * @echo. echo y| cacls "%TARGET%" /T /C /G EVERYONE:F SYSTEM:F attrib /S /D -r -a -s -h "%TARGET%" del /F /S /Q "%TARGET%" GOTO :ENDDEL @ECHO * @ECHO * Not specified if the target is a File or a Directory: @ECHO * @ECHO * %DESC% @ECHO * @ECHO * %TARGET% @ECHO * @ECHO * %FILEORDIR% @ECHO * :ENDDEL @ECHO. GOTO:EOF :ENDPROGRAM @echo --------------------------------------- @echo. @echo End Program. %date% %time% @echo. EXIT
@echo. @echo * Scanning Boot Sector @echo. @echo "C:\Program Files\Windows Defender\MpCmdRun.exe" -Scan -BootSector @echo. "C:\Program Files\Windows Defender\MpCmdRun.exe" -Scan -BootSector @echo. @echo * Full System Scan - (This PC only). @echo. @echo "C:\Program Files\Windows Defender\MpCmdRun.exe" -Scan -ScanType 2 @echo. "C:\Program Files\Windows Defender\MpCmdRun.exe" -Scan -ScanType 2 @echo.
@echo Connecting to NAS. @echo. :: Put the location of your network drive to scan in place of //XXX/XXX: net use X: \\XXX\XXX @echo * Full System Scan - NAS Drive. @echo. @echo "C:\Program Files\Windows Defender\MpCmdRun.exe" -Scan -ScanType 3 -File X: @echo. "C:\Program Files\Windows Defender\MpCmdRun.exe" -Scan -ScanType 3 -File X: @echo.</@echo>
I will add more in the future...