Jump to content

@SW_LOCK


 Share

Recommended Posts

Try something like this and let me know..?

Global $strFileName = @TempDir & '\TempFile.bat' ; Declare temp file name
Global $hdlFileName = FileOpen($strFileName, 2) ; Open handle to file
FileWriteLine($hdlFileName, '@ECHO ON') ; Batch function to show input commands
FileWriteLine($hdlFileName, 'TYPE %Temp%\TempFile.bat') ; First Command
FileWriteLine($hdlFileName, 'DIR /AD') ; Second Command
FileWriteLine($hdlFileName, 'ECHO TestTypeCommand') ; Third Command
FileClose($hdlFileName) ; Close the active handle
Run(@ComSpec & ' /c ' & $strFileName, @TempDir, @SW_SHOW) ; Do stuff
FileDelete($strFileName) ; Cleanup batch file

EDIT: Changed posted code to have Run execute based off of declared file name, rather than hard code.



EDIT: Also changed the FileDelete to use declared file name.

Edited by Wruck
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...