view · edit · history · print

I'm not putting this stuff on the UNIX* WikiScripting page for now, because i don't use much Windows systems (unless they give me no other choice).

Catch command output and put it into a environment variable. I needed to get and use the current path for a UNIX Toolkit on win32 so i could use relative paths from where the batch file is located!

 
FOR /f %%a in ('cd') do set fpath=%%a


YubDOS is a simple batch script that enables you to launch yubnub commands from the windows run dialog (or from DOS command prompt). Simply hit the key combination [win]+[r] and start your YubNub command with the "y"-command. Like so:

  
y gl bootstrap
= == =========
|  |         |
|  |         +-> YubNub command argument
|  +-----------> YubNub command
+--------------> DOS command

Here is the batch script: Attach:y.cmd.txt


ISO timestamps in DOS

  
set timestamp=%date:~-4%%date:~6,2%%date:~3,2%T%time:~0,2%%time:~3,2%%time:~6,2%
echo %timestamp%


Menus in DOS

  
:begin
rem set /P C=[1,2,3]?  rem Original syntax, replaced by "C=".
cls
echo :
echo : 1 = print on screen a
echo : 2 = print letter b
echo : 3 = print "not c"
echo :
set /P C=: ? 
if "%C%"=="1" goto a
if "%C%"=="2" goto b
if "%C%"=="3" goto c

cls
echo WARNING: wrong value, choose new option...
goto begin

:a
echo _a_
goto end
:b
echo _b_
goto end
:c
echo _not c_
goto end

:end


Fake a sleep of 5 seconds

  
set x=5
ping 127.0.0.1 -n %x% -w 1000 > nul

ps: you can also use %1% if you want to CALL it from a batch/command file


find driveletter with ID file

  
SET X=
FOR %%D IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO dir %%D:\ID_BACKUP 1>out 2>err && SET X=%%D
IF "%X%"=="" goto end


admin · attr · attach · edit · history · print
Page last modified on June 05, 2008, at 04:07 AM