Jump to content

RunWait with variables


Recommended Posts

I need to do a runwait with variables ... how would I do this ...

Example script below - problem in red

I dont think you can use runwait in this way however can anyone suggest a workaround

$a="@comspec & ' /c Dir /b /s c:\*."

$c=" >> c:\whwash\cfile.wash',@scriptdir,@SW_HIDE"

FileCopy ("\\Servername\whwash\Suffix\suffix.wash", "c:\whwash\suffix.wash" ,1 )

$suffix_open=FileOpen("c:\whwash\suffix.wash", 0)

If $suffix_open = -1 Then

$fail = FileOpen("c:\whwash\whfail.log", 1)

FileWriteLine($fail, "Script Failed - Could not open suffix.wash")

FileClose($fail)

Exit

EndIf

While 1

$suffix = FileReadLine($suffix_open)

If @error = -1 Then ExitLoop

RunWait ($a & $suffix & $C)

Wend

FileClose("$suffix_open")

Bourny....

Link to comment
Share on other sites

change the c$ setting because the workindir and the flag cannot come with the end of the first parameter

$c=" >> c:\whwash\cfile.wash'"

.....

RunWait ($a & $suffix & $C, @scriptdir, @SW_HIDE)

:D Edited by jpm
Link to comment
Share on other sites

I have tried your suggestion but this does not work... Am Imisunderstanding your comment...

new script below

$a="@comspec & ' /c Dir /b /s c:\*."

$c=" >> c:\whwash\cfile.wash'"

FileCopy ( "\\servername\whwash\Suffix\suffix.wash", "c:\whwash\suffix.wash" ,1 )

$suffix_open=FileOpen("c:\whwash\suffix.wash", 0)

If $suffix_open = -1 Then

$fail = FileOpen("c:\whwash\whfail.log", 1)

FileWriteLine($fail, "Whitewash Script Failed - Could not open suffix.wash")

FileClose($fail)

Exit

EndIf

While 1

$suffix = FileReadLine($suffix_open)

If @error = -1 Then ExitLoop

;RunWait ($a & $suffix & $C)

RunWait ($a & $suffix & $C, @scriptdir, @SW_HIDE)

Wend

FileClose("$suffix_open")

bourny

Link to comment
Share on other sites

Try this:

$a = @comspec & ' /c Dir /b /s c:\*.'
$c = ' >> c:\whwash\cfile.wash'

FileCopy("\\servername\whwash\Suffix\suffix.wash", "c:\whwash\suffix.wash", 1)
$suffix_open = FileOpen("c:\whwash\suffix.wash", 0)

If $suffix_open = -1 Then
$fail = FileOpen("c:\whwash\whfail.log", 1)
FileWriteLine($fail, "Whitewash Script Failed - Could not open suffix.wash")
FileClose($fail)
Exit
EndIf


While 1
$suffix = FileReadLine($suffix_open)
If @error = -1 Then ExitLoop
;RunWait ($a & $suffix & $C)
RunWait ($a & $suffix & $C, @scriptdir, @SW_HIDE)
Wend

FileClose("$suffix_open")
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...