1. @echo off setLocal EnableDelayedExpansion cd C:\Decryptor set N=1 for /F "delims=" %%a in (C:\temp\recordings.txt) do ( encryptwave-w32r-1-1.exe -d "%%a" -o "C:\recordings\recording!N!.wav" set /A N+=1 )

    @echo off
    setLocal EnableDelayedExpansion

    cd C:\Decryptor
    set N=1
    for /F “delims=” %%a in (C:\temp\recordings.txt) do (
    encryptwave-w32r-1-1.exe -d “%%a” -o “C:\recordings\recording!N!.wav”
    set /A N+=1
    )

    See less
    • 0
  2. Expect is a recent addition to windows thanks to the very hard work of the Tcl Core group. I'd suggest that you comment out the chmod +x based on an env check for platform type. Please see the documentation for your proposed platform for what tcl's native 'file attributes' supports. After a brief stRead more

    Expect is a recent addition to windows thanks to the very hard work of the Tcl Core group.
    I’d suggest that you comment out the chmod +x based on an env check for platform type. Please see the documentation for your proposed platform for what tcl’s native ‘file attributes’ supports.

    After a brief study of the script all the rest seems tcl safe cross-platform, though some breakage may be incurred with unsupported options for expect core commands under windows.

    See less
    • 0
  3. ::@echo off ::set /a money=100 ::start ::presuming that a taco costs one unit of money ::echo Press 1 for a taco ::set /p item= ::if %money% lss 1 echo you do not have enough money && goto start ::set /a money=money-1 ::show ::echo %money% ::pause ::another other choice would be to assign eaRead more

    ::@echo off
    ::set /a money=100
    ::start
    ::presuming that a taco costs one unit of money
    ::echo Press 1 for a taco
    ::set /p item=
    ::if %money% lss 1 echo you do not have enough money && goto start
    ::set /a money=money-1
    ::show
    ::echo %money%
    ::pause

    ::another other choice would be to assign each item of food an amount and compare variables.
    @echo off
    set /a money=100
    :start
    ::presuming that a taco costs one unit of money
    echo you may select the following items: taco : sprite : chicken
    set /a taco=1
    set /a sprite=2
    set /a chicken=3
    set /p item=”please type what you want: ”
    set /a item=%item%
    set /a cost=item
    if %money% lss %cost% echo you do not have enough money && goto start
    set /a money=money-item
    :show
    echo %money%
    pause
    goto start

    :: mike

    See less
    • 0
  4. Replace if %choice%==turn on light switch goto correct1 with if "%choice%"=="turn on light switch" goto correct1 A string with spaces must be enclosed by double quotes. This is the cause of your error while what M2 says is anyway right.

    Replace

    if %choice%==turn on light switch goto correct1

    with

    if “%choice%”==”turn on light switch” goto correct1

    A string with spaces must be enclosed by double quotes. This is the cause of your error while what M2 says is anyway right.

    See less
    • 0
  5. VBScript: Const inFilePath = "something.psv" Const outFilePath = "out.psv" With CreateObject("Scripting.FileSystemObject") Set inFile = .OpenTextFile(inFilePath) Set outFile = .OpenTextFile(outFilePath, 2, True) End With outFile.WriteLine inFile.ReadLine outFile.Write inFile.ReadLine

    VBScript:

    Const inFilePath = “something.psv”
    Const outFilePath = “out.psv”

    With CreateObject(“Scripting.FileSystemObject”)
    Set inFile = .OpenTextFile(inFilePath)
    Set outFile = .OpenTextFile(outFilePath, 2, True)
    End With
    outFile.WriteLine inFile.ReadLine
    outFile.Write inFile.ReadLine

    See less
    • 0
  6. WARNING: batch script not tested. @echo off & setlocal EnableDelayedExpansion cd /D E:\images for %%j in (*.jpg) do ( set fname=%%~nj set fname=!fname:*_=! if not exist !fname! md !fname! move %%j !fname! )

    WARNING: batch script not tested.

    @echo off & setlocal EnableDelayedExpansion
    cd /D E:\images
    for %%j in (*.jpg) do (
    set fname=%%~nj
    set fname=!fname:*_=!
    if not exist !fname! md !fname!
    move %%j !fname!
    )

    See less
    • 0
  7. Well then, I might as well use a version that works with batch scripts: Set fso = CreateObject("Scripting.FileSystemObject") Set Win = New RegExp : Win.Pattern = "\r\n" Set Unix = New RegExp : Unix.Pattern = "[^\r]\n" For Each arg In WScript.Arguments file = fso.OpenTextFile(arg).ReadAll If Win.TestRead more

    Well then, I might as well use a version that works with batch scripts:
    Set fso = CreateObject(“Scripting.FileSystemObject”)
    Set Win = New RegExp : Win.Pattern = “\r\n”
    Set Unix = New RegExp : Unix.Pattern = “[^\r]\n”

    For Each arg In WScript.Arguments
    file = fso.OpenTextFile(arg).ReadAll
    If Win.Test(file) Then
    EOL = “=Win32”
    ElseIf Unix.Test(file) Then
    EOL = “=UNIX”
    Else
    EOL = “=Unknown”
    End If
    WScript.Echo fso.GetFileName(arg) & EOL
    Next ‘arg

    Usage (assuming you called the script checkEOL.vbs):
    cscript //nologo checkEOL.vbs

    See less
    • 0
  8. Try =ADDRESS(ROW(cell_name),COLUMN(cell_name)). A cell w/ the above formula will display $B$5, for example. See Excel help for more info on usage/syntax, esp. the helpful abs_num option: ADDRESS(row_num, column_num, [abs_num], [a1], [sheet_text]) In Excel 2007, there's a name manager that you can usRead more

    Try =ADDRESS(ROW(cell_name),COLUMN(cell_name)).
    A cell w/ the above formula will display $B$5, for example.

    See Excel help for more info on usage/syntax, esp. the helpful abs_num option:
    ADDRESS(row_num, column_num, [abs_num], [a1], [sheet_text])

    In Excel 2007, there’s a name manager that you can use to assign cell or range names. You can also select a cell or range of cells & then right click, & select “Name a Range…”.

    See less
    • 0
  9. If IsNull(oRetStatus.StatusCode) Or oRetStatus.StatusCode <> 0 Then sPing = False Else sPing = True End IfNote: This can be rewritten as: sPing = oRetStatus.StatusCode = 0 And Not IsNull(oRetStatus.StatusCode)Function sPing(sHost) As StringAlso, you're returning a Boolean, so you should probabRead more

    If IsNull(oRetStatus.StatusCode) Or oRetStatus.StatusCode <> 0 Then
        sPing = False
    Else
        sPing = True
    End If

    Note: This can be rewritten as:

    sPing = oRetStatus.StatusCode = 0 And Not IsNull(oRetStatus.StatusCode)

    Function sPing(sHost) As String

    Also, you’re returning a Boolean, so you should probably fix your function deceleration.

    Time for good news / bad news.
    Good: I found a WMI class you might be able to use: http://blogs.technet.com/b/heyscrip…

    Bad: This WMI class is not publicly documented, so its implementation is hit and miss. If you need this to work on a number of machines, you’re left with the Windows API.

    How To Ask Questions The Smart Way

    See less
    • 0