- PR -

poorman

1
投稿者投稿内容
Oregon
ベテラン
会議室デビュー日: 2001/08/01
投稿数: 52
お住まい・勤務地: Tualatin 97062
投稿日時: 2001-10-06 01:34
Linux has "rev" filter that reverses each line.
can W2K script do it?

see threads of "stdin ?" and "poorman's "sed"" for hints.
or we may need more.

Oregon
ベテラン
会議室デビュー日: 2001/08/01
投稿数: 52
お住まい・勤務地: Tualatin 97062
投稿日時: 2001-10-06 02:37
oops! the subject line was really POORly crafted.
I meant it to be "poorman's rev"

if you are in need of string output without CR/LF
you may cheat like this:
コード:
@echo off
setlocal
echo wscript.StdOut.Write(wscript.Arguments(0)) > %temp%\wecho.vbs
set wecho=cscript /nologo %temp%\wecho.vbs
%wecho% O
%wecho% K
del %temp%\wecho.vbs
endlocal

Oregon
ベテラン
会議室デビュー日: 2001/08/01
投稿数: 52
お住まい・勤務地: Tualatin 97062
投稿日時: 2001-10-21 06:29
here's an implementation of "rev" that works likes this:
コード:
C:\> rev Able was I ere I saw Elba
ablE was I ere I saw elbA



rev.bat
コード:
@echo off
setlocal
echo if wscript.Arguments.count = 0 then 		> %temp%\wecho.vbs
echo 	wscript.StdOut.Write(" ") 			>> %temp%\wecho.vbs
echo elseif wscript.Arguments(0) = "" then		>> %temp%\wecho.vbs
echo 	wscript.StdOut.Write("""")			>> %temp%\wecho.vbs
echo else						>> %temp%\wecho.vbs
echo 	wscript.StdOut.Write(wscript.Arguments(0))	>> %temp%\wecho.vbs
echo end if					>> %temp%\wecho.vbs
set wecho=cscript /nologo %temp%\wecho.vbs

if "%*"=="" (
    for /f "delims=" %%i in ('more') do (
        set a=%%i
        for /L %%i in (127,-1,0) do if not "!a:~%%i,1!"=="" %wecho% !a:~%%i,1!
        echo.
    )
) else (
    set a=%*
    for /L %%i in (127,-1,0) do if not "!a:~%%i,1!"=="" %wecho% !a:~%%i,1!
)
del %temp%\wecho.vbs
endlocal


Oregon
ベテラン
会議室デビュー日: 2001/08/01
投稿数: 52
お住まい・勤務地: Tualatin 97062
投稿日時: 2001-10-23 02:22
if we allow "rev" to make a mirror program -
of which output is a mirror image of itsef -
then here's one:

コード:
@rev < %~f0



using the same idea of self-reproducing program "@type %~f0"


1

スキルアップ/キャリアアップ(JOB@IT)