Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a VB Expert!

Join 244,297 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 851 people online right now. Registration is fast and FREE... Join Now!




Creating a batch file...

 
Reply to this topicStart new topic

Creating a batch file..., Can't seem to get line returns...

Mystrunner
31 Jul, 2006 - 11:55 AM
Post #1

New D.I.C Head
*

Joined: 7 Jul, 2006
Posts: 9


My Contributions
Hello! I'm working at having VB dynamically create a batch file that will later be used by ftp.exe to download files. The problem is, when it writes out, it prints everything on the same line, which FTP won't/can't use.

Here's what I've been doing:

CODE
''Temp file on local pc
        'strTempMessageName = "C:\Test.bat"

        ''File that temp file gets copied to for paging
        'strDumpFileName = "\Test.bat"

        ''Gets a file number
        'intFileNumber = FreeFile()

        ''Open/create the file
        'FileOpen(FreeFile, strTempMessageName, OpenMode.Output) For Output Access Write As intFileNumber


        ''Write the commands to the .bat file
        'Print(intFileNumber, "open d7vipaa.logistics.cat.com" & Chr(10))
        'Print(intFileNumber, txtUserName.Text & Chr(10))
        'Print(intFileNumber, txtPassword.Text & Chr(10))
        'Print(intFileNumber, "get '" & txtMainframe.Text & "' " & Chr(34) & txtPC.Text & Chr(34) & Chr(10)) 'Directory
        'Print(intFileNumber, "quit")

        ''Close the file number
        'FileClose(intFileNumber)

        ''Dump the file to the paging que (whatever that means)
        'On Error Resume Next
        'FileCopy(strTempMessageName, strDumpFileName)

        'On Error GoTo 0


If anyone has any idea of how to get the bat file to have all seperate lines, I'd be very grateful! Thanks again!

User is offlineProfile CardPM
+Quote Post


William_Wilson
RE: Creating A Batch File...
31 Jul, 2006 - 09:04 PM
Post #2

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 4,446



Thanked: 55 times
Dream Kudos: 3275
Expert In: Java, C, Javascript

My Contributions
the print command in VB assumes that there is no newline placed on the end of the line.
simply add
& vbNewLine
to the end of each line, and the problem should be resolved, with an invisible newline character added to separate your lines of text.

This post has been edited by William_Wilson: 31 Jul, 2006 - 09:04 PM
User is offlineProfile CardPM
+Quote Post

Mystrunner
RE: Creating A Batch File...
1 Aug, 2006 - 04:30 AM
Post #3

New D.I.C Head
*

Joined: 7 Jul, 2006
Posts: 9


My Contributions
It works! Thanks!
User is offlineProfile CardPM
+Quote Post

William_Wilson
RE: Creating A Batch File...
1 Aug, 2006 - 07:05 AM
Post #4

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 4,446



Thanked: 55 times
Dream Kudos: 3275
Expert In: Java, C, Javascript

My Contributions
you are quite welcome, though it's been a while since i've done VB, this happens to be something i've done in the past.
Glad to here it is working smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 04:46PM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month