Monday, 2 September 2013

Error on attempt to create named pipe using VBScript

Error on attempt to create named pipe using VBScript

I'm trying to create named pipe using VBScript on win7. This is my code
(took from there):
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("\\.\pipe\PipeName", True)
a.WriteLine("This is a test.")
a.Close
But i got an error (manual translate, so may be not accurate):
test.vbs(2, 1) Microsoft VBScript runtime error: File not found
Same code with ordinary text file works fine:
Set a = fs.CreateTextFile(".\\PipeName", True)
But, when i tried to escape backslashes:
Set a = fs.CreateTextFile("\\\\.\\pipe\\PipeName", True)
I got:
test.vbs(2, 1) Microsoft VBScript runtime error: Path not found

No comments:

Post a Comment