1.

Solve : Create a file?

Answer»

Hi all.

I woul like to know how can I create a file without a windows or MS-Dos displays. What I need is to create a log file. When my application starts it finds a log file, if it does not exist I want the application create the file using a .bat

I try with a bat that have this line:

edit file.log

The editor is opened but I want to doit without the user see anything, I wanna create the file silently.

Can this be possible?

Im not sure exactly what you are after
If you are running a batch file, and you just want to create a file, this line creates a file of 0 bytes
REM >myfile

If you have an application, then that language will have filesystem constructs (if it doesnt then you should be able to instantiate a filesystemobject and use that to create your file

GrahamThere is the possibility of opening the .bat file minimised - please Google for info.

If you intend to use the Edit utility how will you enter any data without the user knowing :-?

Why not just check for the file and if not exist then create it in your application :-?What I need is to use the file as a log. When my application starts, it finds a log file, if doesn't exist, i want to create it without the user see anything.

I know the edit can start minimized, but I don have to write nothing, just create the file. My application use the file to write data.

My application is developed with PowerBuilder and can write, copy en read from a file but no create it.

I don't wanna have any copy of that file to copy if doesn't exists, I want to know how can I create the file with the name and extention that I WISH, without prompts, without asistance, but I dont know how.

I hope you can helme...
I think what you want is easy.
Open the BLOCK notes of windows and save the file as (name).log where you desire...


Just in case the file doesn't exist my application have to create the file. Can I use a bat file or any function of Windows to do it?

I ALREADY use the notepad to create the log file. In case I install the application in a new client, the application starts for the first time, looks for the file end if can't find it, the application can create the file.

I want to use a bat file to do it because from my application is easy to do, just writing in my code the function RUN(C:\app_path\log.bat)

If you know how to do a file in other way, please tell me how...This is mind numbing. Are you creating a log file with a .bat extension? You can create an empty (well, 3 bytes actually but who's counting?) file with:

if not exist c:\app_path\log.bat echo. > c:\app-path\log.bat

Most languages have file system functions. If you can test for the existence of a file within your application, most likely you can open the file as append or as output, whichever is appropriate. Why do you need a batch solution?

8-)Hi

Now I can create it with my application.

The bat is for run it from the app so the bat need to contain a line to create a file, for example edit logfile.log

when I run this bat the DOS launch the edit application with the file but I wanna create the file whithout see anything, silently.

comments?

What is your real goal is all of this? You have spent a lot of time beating around the bush.Use the start command with the /min switch. Be sure not to have any commands in your batch file that create a console interrupt. Batch files need the command or cmd shell to run, with START it will be minimized but not invisible.

Using a batch file to launch an application is fine in DOS. You would be better served with a Win Script to run within the Windows environment where the script will run UNNOTICED by the user.

Good luck. 8-)

Sorry man, if you think I have spent a lot of time beating around the bush just don't write cos your post don't help anybody so keep working or keep quiet with your answers.

For enybody who try help me I say thankyou...



Discussion

No Comment Found