Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - VBS script question

Reply
 
Old 10-20-2008   #1 (permalink)
rogv


 
 

VBS script question

I have a VBS script and it looks for a file in local drive:

LocFolder = "C:\myfiles"

It works fine.

I am trying to make adjustments so it can also read from a mapped
drive.
Any hints. thanks

My System SpecsSystem Spec
Old 10-20-2008   #2 (permalink)
Pegasus \(MVP\)


 
 

Re: VB script question


"rogv" <rvaedex23@xxxxxx> wrote in message
news:c31ecefe-2708-4205-a179-565e2b109afd@xxxxxx
Quote:

>I have a VBS script and it looks for a file in local drive:
>
> LocFolder = "C:\myfiles"
>
> It works fine.
>
> I am trying to make adjustments so it can also read from a mapped
> drive.
> Any hints. thanks
Have you tried UNC coding?
LocFolder = "\\RemotePC\ShareName\FolderName"


My System SpecsSystem Spec
Old 10-20-2008   #3 (permalink)
rogv


 
 

Re: VB script question

On Oct 20, 4:15*pm, "Pegasus \(MVP\)" <I....@xxxxxx> wrote:
Quote:

> "rogv" <rvaede...@xxxxxx> wrote in message
>
> news:c31ecefe-2708-4205-a179-565e2b109afd@xxxxxx
>
Quote:

> >I have a VBS script and it looks for a file in local drive:
>
Quote:

> > LocFolder = "C:\myfiles"
>
Quote:

> > It works fine.
>
Quote:

> > I am trying to make adjustments so it can also read from a mapped
> > drive.
> > Any hints. *thanks
>
> Have you tried UNC coding?
> LocFolder = "\\RemotePC\ShareName\FolderName"
Yes, It says it cannot find path. For local folders it works OK.
My System SpecsSystem Spec
Old 10-20-2008   #4 (permalink)
Pegasus \(MVP\)


 
 

Re: VB script question


"rogv" <rvaedex23@xxxxxx> wrote in message
news:d95a8d04-98ef-43c2-b5be-4ab68149fd86@xxxxxx
On Oct 20, 4:15 pm, "Pegasus \(MVP\)" <I....@xxxxxx> wrote:
Quote:

> "rogv" <rvaede...@xxxxxx> wrote in message
>
> news:c31ecefe-2708-4205-a179-565e2b109afd@xxxxxx
>
Quote:

> >I have a VBS script and it looks for a file in local drive:
>
Quote:

> > LocFolder = "C:\myfiles"
>
Quote:

> > It works fine.
>
Quote:

> > I am trying to make adjustments so it can also read from a mapped
> > drive.
> > Any hints. thanks
>
> Have you tried UNC coding?
> LocFolder = "\\RemotePC\ShareName\FolderName"
Yes, It says it cannot find path. For local folders it works OK.

=================

This means that you have a permission issue or a error in the name. Try this
humble command from a Command Prompt:
dir "\\RemotePC\ShareName\FolderName"

If this works and your script does not work then you should post your
script.


My System SpecsSystem Spec
Old 10-21-2008   #5 (permalink)
rogv


 
 

Re: VB script question

On Oct 20, 5:40*pm, "Pegasus \(MVP\)" <I....@xxxxxx> wrote:
Quote:

> "rogv" <rvaede...@xxxxxx> wrote in message
>
> news:d95a8d04-98ef-43c2-b5be-4ab68149fd86@xxxxxx
> On Oct 20, 4:15 pm, "Pegasus \(MVP\)" <I....@xxxxxx> wrote:
>
>
>
>
>
Quote:

> > "rogv" <rvaede...@xxxxxx> wrote in message
>
Quote:

> >news:c31ecefe-2708-4205-a179-565e2b109afd@xxxxxx
>
Quote:
Quote:

> > >I have a VBS script and it looks for a file in local drive:
>
Quote:
Quote:

> > > LocFolder = "C:\myfiles"
>
Quote:
Quote:

> > > It works fine.
>
Quote:
Quote:

> > > I am trying to make adjustments so it can also read from a mapped
> > > drive.
> > > Any hints. thanks
>
Quote:

> > Have you tried UNC coding?
> > LocFolder = "\\RemotePC\ShareName\FolderName"
>
> Yes, It says it cannot find path. *For local folders it works OK.
>
> =================
>
> This means that you have a permission issue or a error in the name. Try this
> humble command from a Command Prompt:
> dir "\\RemotePC\ShareName\FolderName"
>
> If this works and your script does not work then you should post your
> script.- Hide quoted text -
>
> - Show quoted text -
Does the folder has to be shared for it to work?
My System SpecsSystem Spec
Old 10-22-2008   #6 (permalink)
Python


 
 

Re: VBS script question

If the drive is mapped then it can be treated as a local drive. You
shouldn't have to modify the code at all. I agree that it may be a
permission problem. If you are at a command prompt, can you "type" the file?
For example, let's assume that the mapped drive is "Z:" and the file you are
trying to read is

z:\myfolder\myfile.txt

Let us also assume that you are currently at the root of the C drive. What
happens when you do the following"

C:\>type z:\myfolder\myfile.txt

If you can list the file from the command prompt then your script should
work as well (but because I haven't seen your script I will reserve
judgement). What error do you get when you try to read from the mapped
drive?


My System SpecsSystem Spec
Old 10-22-2008   #7 (permalink)
gimme_this_gimme_that


 
 

Re: VBS script question

Don't forget that you need to escape spaces, colons and back slashes.

All I have handy is this unescape VBA method - but you get the
idea ...

Function unescape(s As String) As String
s = Application.Substitute(s, "%20", " ")
s = Application.Substitute(s, "%3A", ":")
s = Application.Substitute(s, "%5C", "\")
unescape = s
End Function

Incidentally VBScript has an escape function built in. WScript I
haven't checked.
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
question on: HTA and format to include external script file VB Script
vbs script question VB Script
Question - flushing out powershell.exe when existing a script PowerShell
Newbie question - Is there a script/command to do a backup of a di PowerShell
Newbie Question: Here-Script with PowerShell PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46