Jump to content

enter keystroke and @ComSpec


A.B.Ames
 Share

Recommended Posts

This may be wierd as but i'm trying to create a very small bat file from autoit and i thought that i could do it with RunWait(@ComSpec & Copy Con) command. But i can't seem to figure out how to create an enter keystroke as it needs a couple lines.

exg.

RunWait(@ComSpec & " /k" & "Copy Con c:\regowner\Cleanup.bat" & @CRLF & "LINE1" & @CRLF & "LINE2" & @CTLF & "LINE3")

any chance of getting an enterkey press in the middle where i put the @CTLF?

tried {enter} but i think thats only for the SEND command.

Thx For any assistance

TKAre

A.B.Ames

Link to comment
Share on other sites

Tried some things with your code but using that way is impossible.

Try this:

$OpenNewBatch = FileOpen("c:\regowner\Cleanup.bat", 2)
   FileWriteLine($OpenNewBatch, "LINE1")
   FileWriteLine($OpenNewBatch, "LINE2"
   FileWriteLine($OpenNewBatch, "LINE3")
FileClose($OpenNewBatch)

If you don't understand the functions, look them up in the help file.

Contains alot of info.

Edited by SlimShady
Link to comment
Share on other sites

Many Thx SlimShady:

You sample helped me out greatly in understanding how the FileWrite with FileOpen works, runs great (and seems so simple now).

I had come across it and a few other ideas of doing this but being new to this wasn't sure which was best and couldn't get it figured out right, Thanks for clearing it up.

Though i was also curious as to if a Enter keystroke could be applied inside a line but it appears not.

Again, many thx

Take Care

A.B.Ames

Link to comment
Share on other sites

Also can just writeline:

FileWriteLine("c:\mybat.bat","del c:\mybat.bat" & @crlf & "dir c:\")

use @crlf for returns in files.

@Slim forgot a )

$OpenNewBatch = FileOpen("c:\regowner\Cleanup.bat", 2)
  FileWriteLine($OpenNewBatch, "LINE1")
  FileWriteLine($OpenNewBatch, "LINE2") 
  FileWriteLine($OpenNewBatch, "LINE3")
FileClose($OpenNewBatch)
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

Many thx too scriptkitty:

Sorry for delay in responding was trying to get the script done for a friend.

This seems to be what i was trying to do but I did all the wrong ways. Didn't realize you could write to a file like this without having to open it in notepad or use DOS via ComSpec.

and helps me more understand the FileXxx abilities.

Again, Many Thx

TKAre

A.B.Ames

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...