forked from PassingTheKnowledge/Batchography
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit: scripts/recipes and snippets from the Batchography bo…
…ok (http://amzn.to/1X3tQ4K)
- Loading branch information
0 parents
commit 1ab6f5a
Showing
169 changed files
with
5,041 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo off | ||
prompt $+%PROMPT% | ||
doskey /macrofile=%~dp0cmdinit.macro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@echo off | ||
:: | ||
:: The Batchography book by Elias Bachaalany | ||
:: | ||
|
||
:main | ||
if exist log.txt del log.txt | ||
|
||
pushd compiler | ||
if not exist cl.exe ( | ||
echo The compiler was not found! | ||
goto :end | ||
) | ||
|
||
cl.exe hello.c | ||
|
||
if %ERRORLEVEL% EQU 0 ( | ||
echo Compilation successful! | ||
) ELSE ( | ||
echo Compilation failed! | ||
) | ||
|
||
:end | ||
POPD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@echo arg0=%0, arg1=%1, arg2=%2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@echo All arguments: %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@echo off | ||
|
||
:main | ||
if "%1"=="" goto Usage | ||
if "%1"=="compress" goto compress | ||
if "%1"=="uncompress" goto uncompress | ||
|
||
rem Unknown command passed, display the usage! | ||
echo Unknown command '%1'!! | ||
goto usage | ||
|
||
:Usage | ||
ECHO %0 compress^|uncompress archive.zip | ||
goto end | ||
|
||
:compress | ||
if "%2"=="" ( | ||
echo No archive name was passed! | ||
goto Usage | ||
) | ||
|
||
echo Compressing current folder into archive '%2' | ||
REM invoke the compression utility | ||
goto end | ||
|
||
:uncompress | ||
if "%2"=="" goto Usage | ||
if "%2"=="" ( | ||
echo No archive name was passed! | ||
goto Usage | ||
) | ||
|
||
if not exist %2 ( | ||
ECHO The archive '%2' is not found! | ||
goto end | ||
) | ||
echo Uncompressing the archive '%2' into the current folder | ||
REM invoke the decompression utility | ||
goto end | ||
|
||
:end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@echo off | ||
|
||
:: | ||
:: The Batchography book by Elias Bachaalany | ||
:: | ||
|
||
|
||
:repeat | ||
if "%1"=="" goto end | ||
echo Arg: %1 | ||
|
||
SHIFT | ||
|
||
goto repeat | ||
|
||
:end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@echo off | ||
|
||
echo Args 1 to 6 are: %1 %2 %3 %4 %5 %6 | ||
|
||
shift /3 | ||
|
||
echo New args 1 to 6 are: %1 %2 %3 %4 %5 %6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@echo off | ||
|
||
:: | ||
:: The Batchography book by Elias Bachaalany | ||
:: | ||
|
||
echo Self is: %0 | ||
|
||
:: Start modifiers example | ||
echo 1. without quotes: %~0 | ||
echo 2. fully qualified path name: %~f0 | ||
echo 3. drive letter: %~d0 | ||
echo 4. path part: %~p0 | ||
echo 5. just the file name part: %~n0 | ||
echo 6. just the extension part: %~x0 | ||
echo 7. file's attributes: %~a0 | ||
echo 8. file's date and time: %~t0 | ||
echo 9. file's size: %~z0 | ||
echo 10. file path in the PATH environment variable search: %~$PATH:0 | ||
echo 11. file's full path: %~dp0 | ||
echo 12. file's name and extension part: %~nx0 | ||
echo 13. 'dir' like modifier: %~ftza0 | ||
echo 14. fully qualified script path: %~dpnx0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@echo off | ||
|
||
echo The first argument as is: %1 | ||
|
||
:: Start modifiers example | ||
echo 1. without quotes: %~1 | ||
echo 2. fully qualified path name: %~f1 | ||
echo 3. drive letter: %~d1 | ||
echo 4. path part: %~p1 | ||
echo 5. just the file name part: %~n1 | ||
echo 6. just the extension part: %~x1 | ||
echo 7. file's attributes: %~a1 | ||
echo 8. file's date and time: %~t1 | ||
echo 9. file's size: %~z1 | ||
echo 10. file path in the PATH environment variable search: %~$PATH:1 | ||
echo 11. file's full path: %~dp1 | ||
echo 12. file's name and extension part: %~nx1 | ||
echo 13. 'dir' like modifier: %~ftza1 | ||
echo 14. fully qualified script path: %~dpnx0 |
Oops, something went wrong.