Sign in to follow this  
Followers 0
CEBSS

FileWriteLine

6 posts in this topic

Hi

Attached is a working demo scipt I have made.

My problem is, I do not want to type "FileWriteLine" in front of each line in my creation of my .bat.

Is there a shorter way?

I have tried "FileSplitLine" to no avail.

Regards

Alistair

PS: I am a new to programming.

Share this post


Link to post
Share on other sites



Is there any particular reason you're reason a batch file? Why not simply write a script that does all of that?

Share this post


Link to post
Share on other sites

$text = "@echo off" & @CRLF  & _
"ECHO PLEASE WAIT WENA" & @CRLF  & _
"echo   ...........I SAID WAIT ..........." & @CRLF  & _
"@echo off" & @CRLF  & _
"ECHO PLEASE WAIT WENA" & @CRLF  & _
"echo   ...........I SAID WAIT ..........." & @CRLF  & _
"@if not exist c:\ali goto 2" & @CRLF  & _
"@del c:\ali\*.* /f /q" & @CRLF  & _
"@echo hello this file exists >>\hello.log" & @CRLF  & _
"date /t  >>\hello.log" & @CRLF  & _
"time /t  >>\hello.log" & @CRLF  & _
"@copy \deleted\test.iva \ali" & @CRLF  & _
"@echo test.avi copied to ali >>\hello.log" & @CRLF  & _
"@cd \ali" & @CRLF  & _
"@\pkzip test test.iva " & @CRLF  & _
"@echo test.avi has been zipped >>\hello.log" & @CRLF  & _
"goto End" & @CRLF  & _
":2" & @CRLF  & _
"@MD\ali" & @CRLF  & _
"@echo ali is now made >>\ali.log" & @CRLF  & _
"@copy \deleted\test.iva \ali" & @CRLF  & _
"@echo test.avi copied to ali >>\ali.log" & @CRLF  & _
"date /t  >>\ali.log" & @CRLF  & _
"time /t  >>\ali.log" & @CRLF  & _
"@cd \ali" & @CRLF  & _
"@\pkzip test test.iva " & @CRLF  & _
"@echo test.avi has been zipped >>\ali.log" & @CRLF  & _
":End" & @CRLF  & _
"exit" & @CRLF

or

$text = "@echo off" & @CRLF
$text &= "ECHO PLEASE WAIT WENA" & @CRLF
$text &= "echo   ...........I SAID WAIT ..........." & @CRLF 
$text &= "@echo off" & @CRLF 
$text &= "ECHO PLEASE WAIT WENA" & @CRLF  
$text &= "echo   ...........I SAID WAIT ..........." & @CRLF  
$text &= "@if not exist c:\ali goto 2" & @CRLF  
$text &= "@del c:\ali\*.* /f /q" & @CRLF  
$text &= "@echo hello this file exists >>\hello.log" & @CRLF  
$text &= "date /t  >>\hello.log" & @CRLF  
$text &= "time /t  >>\hello.log" & @CRLF 
$text &= "@copy \deleted\test.iva \ali" & @CRLF 
$text &= "@echo test.avi copied to ali >>\hello.log" & @CRLF 
$text &= "@cd \ali" & @CRLF  
$text &= "@\pkzip test test.iva " & @CRLF  
$text &= "@echo test.avi has been zipped >>\hello.log" & @CRLF  
$text &= "goto End" & @CRLF  
$text &= ":2" & @CRLF  
$text &= "@MD\ali" & @CRLF  
$text &= "@echo ali is now made >>\ali.log" & @CRLF  
$text &= "@copy \deleted\test.iva \ali" & @CRLF 
$text &= "@echo test.avi copied to ali >>\ali.log" & @CRLF  
$text &= "date /t  >>\ali.log" & @CRLF  
$text &= "time /t  >>\ali.log" & @CRLF  
$text &= "@cd \ali" & @CRLF 
$text &= "@\pkzip test test.iva " & @CRLF 
$text &= "@echo test.avi has been zipped >>\ali.log" & @CRLF  
$text &= ":End" & @CRLF 
$text &= "exit" & @CRLF

Use FileWrite.

Share this post


Link to post
Share on other sites

Pain...

I cannot thank you enough, it works like a charm.

Thank you

Alistair

Share this post


Link to post
Share on other sites

One more thing

How do I mark this topic closed

Share this post


Link to post
Share on other sites

Edit your first post and add [solved] to the title.

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