Valutazione attuale: 1 / 5

Stella attivaStella inattivaStella inattivaStella inattivaStella inattiva
 

Here a collection of dos script. Just my notes shared with you.

 

 

SHOW PATH VARIABLE FORMATTED

It replace the semicolon with ECHO

@echo off
REM Simple way to show path formatted, replacing ; with echo
ECHO %PATH:;= & ECHO.%

 

 

 

 

 

GET CURRENT BATCH INFO

@echo off
REM filename :  c:\temp\test.cmd
echo %0
echo %~d0
echo %~dp0
echo %~nx0

IT WILL OUTPUT
=================
c:\temp\test.cmd
c:\temp\
c:
test.cmd
C:\>

 

 

Execute a type of all text files specified and create a new file.

We can do it using "forfile" command. All file eml will be joint in the file all.txt using the dos "type" command for each eml file.

REM all.txt will contain all contents of files eml
forfiles /m *.eml /C "CMD /c type @file >> all.txt"

 

 

MISCELLANEOUS

Some useful stuff

::        this is a comment line and it is like REM
%~1       Remove double quotes from argument 1
echo ^<   The char ^ allow to ignore next special char < same for >

 

 

DISQUS - Leave your comments here