1

I have vbscript application that run in a server and I tried run that application in my local computer. The problem is I want to create a text file in server directory but I always end up with an error something like "disk is not ready". When I check, it is because in my local computer, there is only 1 partition Drive C: and for some reason the application try to make the textfile in my local directory. And if change the path to drive C: it works and the file is existed in my local directory. So what am I doing wrong? I want the text file is created in server directory.

Here's part of my code :

Dim fso, MyFile

Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("D:\tesfolder\SomeText.txt", True)
MyFile.WriteLine("This is a test.")
MyFile.Close
Set MyFile = Nothing
Set fso = Nothing

please help me

1 Answer 1

1
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("\\127.0.0.1\C$\SomeText.txt", True)
MyFile.WriteLine("This is a test.")
MyFile.Close

The above needs Admin because it uses the Admin only share (present on all computers) c$ and writes to the root of C: drive.

The format is

\\ServerName(orIP)\ShareName\Folder\File.ext

An admin would

\\Computer\D$\tesfolder\SomeText.txt

For a user substitute their share name for D$.

Sign up to request clarification or add additional context in comments.

1 Comment

It works!!Thanks for the answer..I really appreciate it..really thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.