Jump to content

Please help with DOS Conversion


Recommended Posts

I would like to get this converted to work in an AutoIt script:

For /F "tokens=*" %%A in ('Dir /B /A:-D *.imc') Do (ShelExec %%A)

I would also like it to work in all windows OS if possible as I heard this DOS command only works in NT systems.

Link to comment
Share on other sites

I would like to get this converted to work in an AutoIt script:

For /F "tokens=*" %%A in ('Dir /B /A:-D *.imc') Do (ShelExec %%A)

I would also like it to work in all windows OS if possible as I heard this DOS command only works in NT systems.

<{POST_SNAPBACK}>

I assume 'ShelExec' is an external program? Then try this:

$search = FileFindFirstFile("*.imc")  

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched *.imc")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop

    $attrib = FileGetAttrib($file)
    
   ; Skip directories   
    If StringInStr($attrib, "D") Then ContinueLoop  
 
    RunWait ("ShelExec "& $file)

WEnd

; Close the search handle
FileClose($search)

The code above is NOT tested, could be full with typo's. It's just to give you an idea how you could do it.

Regards,

-Sven

Link to comment
Share on other sites

SvenP:

ShelExec is an external program. A very simple utility to allow you to call the ShellExecute API from the command line.

This is a replacement to the commonly used start.exe which does not work on NT because on NT "start" is implemented as an "Internal" command in cmd.exe

It can be found here http://www.naughter.com/shelexec.html

Thanks for the code I will give it a try.

CyberSlug:

What the line does is run an external program in this case ShellExec against everyfile in the folder which has an imc extension.

ShellExec opens the file with the program which is registered with the windows shell.

For /F "tokens=*" %%A in ('Dir /B /A:-D *.imc') Do (ShelExec %%A)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...