Search for filename and get full path and filename returned.
FOR /f "tokens=1,2,*" %a in ('dir /s %fileToCheck%') do if "%a %b" == "Directory of" SET pathAndFilename=%c\%fileToCheck%
Thanks to Leif Ole for this example
For every 1603 in the World
Search for filename and get full path and filename returned.
FOR /f "tokens=1,2,*" %a in ('dir /s %fileToCheck%') do if "%a %b" == "Directory of" SET pathAndFilename=%c\%fileToCheck%
Thanks to Leif Ole for this example
Run multiple commands in one line with Windows Command Shell.
START /W CMD.EXE /C & C: & CD\ & DEL /F /S /Q "[filename]" >"%temp%\delete.log"
START /W CMD.EXE /C & DEL /F /Q "[path][filename]" >"%temp%\delete.log"
You can use the special characters listed in the following table to pass multiple commands.
Character | Syntax | Definition |
---|---|---|
& […] | command1 & command2 | Use to separate multiple commands on one command line. Cmd.exe runs the first command, and then the second command. |
&& […] | command1 && command2 | Use to run the command following && only if the command preceding the symbol is successful. Cmd.exe runs the first command, and then runs the second command only if the first command completed successfully. |
|| […] | command1 || command2 | Use to run the command following || only if the command preceding || fails. Cmd.exe runs the first command, and then runs the second command only if the first command did not complete successfully (receives an error code greater than zero). |
( ) […] | ( command1 & command2) | Use to group or nest multiple commands. |
; or , | command1 parameter1;parameter2 | Use to separate command parameters. |
Note: The ampersand (&), pipe (|), and parentheses ( ) are special characters that must be preceded by the escape character (^) or quotation marks when you pass them as arguments
Note: This method can also be used in a .MSI package, through a Custom Action
Source: Microsoft
Start Remote Assistance in Windows from the Command Line. You can also request help or offer your skills as an expert.
"%windir%\system32\msra.exe" /offerra
"%windir%\system32\msra.exe" /novice
"%windir%\system32\msra.exe" /expert
Usage
Create a shortcut and enter first command line, shown above, as the target. Remember to elevate/run as if you are using differenced user accounts
Goto Microsoft TechNet for detailed information about Command Shell
– Command-line options for Windows Command Shell
Goto JR Software for detailed information about Inno Setup
– Command-line options for Inno Setup
Goto Microsoft for detailed information about Windows Installer
– Command-line options for Windows Installer