command | description |
---|---|
|
Does not echo back the text after the |
|
for everything |
|
the command used to call the batch file (could be foo, ..\foo, c:\bats\foo, etc.) |
|
is the first command line parameter, |
|
|
|
is the 9th command line. |
|
One of two ways of adding remarks into the batch |
|
A label allows you to skip to certain sections of a batch file, see |
|
Used to go to a certain label (LB). |
|
A call is used to run another batch file within a batch file. |
|
Used for Windows 95 and later to start a Windows application |
|
Will echo a message in the batch file. |
command | description |
---|---|
|
the actual name of the batch file, regardless of calling method (some-batch.bat) |
|
drive and path to the script (d:\scripts) |
|
is the fully qualified path name of the script (d:\scripts\some-batch.bat) |
%var:~0,-4% // (1)
-
the
-4
means that the last 4 digits (presumably .ext) will be truncated
if ERROR (
ECHO this is the error.
GOTO:error
)
REM DO YOUR JOB HERE
REM ... till the end
GOTO:EOF
:error
ECHO.
ECHO Press any key to exit.
PAUSE >nul
GOTO:EOF
Checks if the command exists before I run it. i.e. if the command is reachable in PATH.
WHERE mycommand
IF %ERRORLEVEL% NEQ 0 ECHO mycommand wasn't found
@echo off
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
REM Display the error and quit
) else (
REM Do whatever needs admin rigth
)
FORFILES /S /M *.doc /C "cmd /c echo @fname : @fsize"
Keyword | Description |
---|---|
|
filename. |
|
filename wo extension. |
|
extension. |
|
absolute path. |
|
relative path. |
|
TRUE if it is a directory, FALSE otherwise. |
|
File size in bytes. |
|
Last modification date. |
|
Last modification time. |
At startup, windows shows error "Failed to reconnect network drives.". But once you click on the drive, it become working.
A: Not proven: ensure all devices share the same network name (eg: WORKGROUP) B: Not working: Enable Linked Connections in registry. Create a reg file (eg. nameg nas.reg), copy-paste the following and execute.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"EnableLinkedConnections"=dword:00000001