Sign in to follow this  
Followers 0
ptestfall

Simple Batch Job

6 posts in this topic

Hi,

the simple thing I want to do is a dos command:

echo text > $1

and convert the autoit-file to an exe-file and give the name of the text file as a parameter like e.g. "test.exe textfile.txt".

But if I use autoit with

Run("cmd /c echo text > $1")

and convert it to a exe-file I cannot give a parameter upon execution or it is ignored and the result is a file named $1 with "text" in it.

Please help me with this little problem.

Thanks

pt

Share this post


Link to post
Share on other sites



would an input box work...run the exe and asks for the textfile name

or can it just use a default one? lets say text.txt?


_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Share this post


Link to post
Share on other sites

An input box is unwanted and a default filename as well.

The command for execution should be:

test.exe textfile.txt

Where test.exe is a compiled autoit script and textfile.txt is just an example.

In the end I want to end a complete path like "C:\Program Files\Installation\textfile.txt".

Share this post


Link to post
Share on other sites

Hi,

something like:

If $cmdLine[0] = 2 Then
;Run("cmd /c echo " &  $cmdLine[1] & ">" & $cmdLine[2])
    Run(@ComSpec & " /c " & 'echo '&  $cmdLine[1] & ">" & $cmdLine[2], "", @SW_HIDE)
Else
    MsgBox(64, "Error", "Needs two parameters" & @CRLF & @CRLF & _
    "1. text" & @CRLF & _
    "2. filename.extension")
EndIf

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Or

If $CmdLine[0] > 0 Then
    FileWriteLine($CmdLine[1], "text")
EndIf

Share this post


Link to post
Share on other sites

Thanks very much for your great and quick help :think:

Share this post


Link to post
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
Sign in to follow this  
Followers 0