Copying a file

J

Jim in Arizona

I want to make a logon script for domain users that do the following when
they log on:

1) make a directory on the c drive (i know I can do this using md
c:\path)
2) copy a file from a network drive to the newly created local folder
(which I can do with xcopy "f:\network path\file.mdb" "c:\path\file.mdb")
3) make a shortcut of c:\path\file.mdb to all users\desktop

Number 3 is where that gets really confusing for me. I have no idea.

Thanks for your help.

Jim
 
D

Dave Patrick

A couple of ways to do this include using the CreateShortcut method of
VBScript. Or try Marty List's cool tool Shortcut v. 100
http://optimumx.com/download/#Shortcut


This VBScript would create a shortcut to a mapped drive 'S:\'
--------------------------
set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("AllUsersDesktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\S Drive.lnk")
oShellLink.TargetPath = "S:\"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "explorer.exe, 1"
oShellLink.Description = "Network S Drive"
oShellLink.WorkingDirectory = "S:\"
oShellLink.Save
Set WshShell = Nothing
Set oShellLink = Nothing
--------------------------

Also WSH 5.6 documentation download at
http://www.microsoft.com/downloads/...48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en



--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
|I want to make a logon script for domain users that do the following when
| they log on:
|
| 1) make a directory on the c drive (i know I can do this using md
| c:\path)
| 2) copy a file from a network drive to the newly created local folder
| (which I can do with xcopy "f:\network path\file.mdb" "c:\path\file.mdb")
| 3) make a shortcut of c:\path\file.mdb to all users\desktop
|
| Number 3 is where that gets really confusing for me. I have no idea.
|
| Thanks for your help.
|
| Jim
|
|
 
M

Matthias Tacke

Dave said:
A couple of ways to do this include using the CreateShortcut method of
VBScript. Or try Marty List's cool tool Shortcut v. 100
http://optimumx.com/download/#Shortcut


This VBScript would create a shortcut to a mapped drive 'S:\'
<snip>

Just to add some more choices ;-)

Free Makescut.exe
http://www.scriptlogic.com/eng/products/scriptingtoolkit/

SCUT.EXE
http://www.jsiinc.com//dl/scut11.zip

Frank P. Westlake - LN.EXE
http://gearbox.maem.umr.edu/fwu/

Assemble an inf file to create link
http://www.google.com/[email protected]

One of several vbscript
http://www.google.com/[email protected]

A batch creates a vbscript which creates a lnk
http://www.google.com/[email protected]
 
J

Jim in Arizona

I tried that code below on my own system and it didn't do anything at first.
I did change the path from S to F. After looking at that first link you gave
me (http://optimumx.com/download/#Shortcut) and looking at their example, I
changed your code just a little bit:

strDesktop = WshShell.SpecialFolders("AllUsersDesktop")

changed to:

strDesktop = WshShell.SpecialFolders("%allusersprofile%\desktop")

That worked perfectly!

Thanks A LOT for your help Dave.

Jim
 
D

Dave Patrick

Glad you got something to work. I just tried it again to be sure it works as
advertised and it does. In order to use;
%allusersprofile%
You would have to do something like;

Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("Process")
WScript.Echo WshSysEnv("allusersprofile")

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
|I tried that code below on my own system and it didn't do anything at
first.
| I did change the path from S to F. After looking at that first link you
gave
| me (http://optimumx.com/download/#Shortcut) and looking at their example,
I
| changed your code just a little bit:
|
| strDesktop = WshShell.SpecialFolders("AllUsersDesktop")
|
| changed to:
|
| strDesktop = WshShell.SpecialFolders("%allusersprofile%\desktop")
|
| That worked perfectly!
|
| Thanks A LOT for your help Dave.
|
| Jim
|
|
|
| | >A couple of ways to do this include using the CreateShortcut method of
| > VBScript. Or try Marty List's cool tool Shortcut v. 100
| > http://optimumx.com/download/#Shortcut
| >
| >
| > This VBScript would create a shortcut to a mapped drive 'S:\'
| > --------------------------
| > set WshShell = WScript.CreateObject("WScript.Shell")
| > strDesktop = WshShell.SpecialFolders("AllUsersDesktop")
| > set oShellLink = WshShell.CreateShortcut(strDesktop & "\S Drive.lnk")
| > oShellLink.TargetPath = "S:\"
| > oShellLink.WindowStyle = 1
| > oShellLink.IconLocation = "explorer.exe, 1"
| > oShellLink.Description = "Network S Drive"
| > oShellLink.WorkingDirectory = "S:\"
| > oShellLink.Save
| > Set WshShell = Nothing
| > Set oShellLink = Nothing
| > --------------------------
| >
| > Also WSH 5.6 documentation download at
| >
http://www.microsoft.com/downloads/...48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en
| >
| >
| >
| > --
| > Regards,
| >
| > Dave Patrick ....Please no email replies - reply in newsgroup.
| > Microsoft Certified Professional
| > Microsoft MVP [Windows]
| > http://www.microsoft.com/protect
| >
| > "Jim in Arizona" wrote:
| > |I want to make a logon script for domain users that do the following
when
| > | they log on:
| > |
| > | 1) make a directory on the c drive (i know I can do this using md
| > | c:\path)
| > | 2) copy a file from a network drive to the newly created local
folder
| > | (which I can do with xcopy "f:\network path\file.mdb"
| > "c:\path\file.mdb")
| > | 3) make a shortcut of c:\path\file.mdb to all users\desktop
| > |
| > | Number 3 is where that gets really confusing for me. I have no idea.
| > |
| > | Thanks for your help.
| > |
| > | Jim
| > |
| > |
| >
| >
|
|
 
M

Michael Bednarek

I want to make a logon script for domain users that do the following when
they log on:

1) make a directory on the c drive (i know I can do this using md
c:\path)
2) copy a file from a network drive to the newly created local folder
(which I can do with xcopy "f:\network path\file.mdb" "c:\path\file.mdb")
3) make a shortcut of c:\path\file.mdb to all users\desktop

Number 3 is where that gets really confusing for me. I have no idea.

In addition to the other excellent suggestions, there is a rather
pedestrian way of doing this: create a shortcut (.LNK) to
C:\path\file.mdb on your system once, place it in "F:\network path\" and
copy it in your logon script to "%AllUsersProfile%\Desktop".
 
M

Mark V

In said:
<snip>

Just to add some more choices ;-)

Free Makescut.exe
http://www.scriptlogic.com/eng/products/scriptingtoolkit/

SCUT.EXE
http://www.jsiinc.com//dl/scut11.zip

Frank P. Westlake - LN.EXE
http://gearbox.maem.umr.edu/fwu/

Assemble an inf file to create link
http://www.google.com/groups?selm=82qedt$41dg$1@newssvr04-int
.news.prodigy.com

One of several vbscript
http://www.google.com/groups?selm=Xns92791CF1F40BFirstZodiacNOTVALI
Dh%40207.46.239.39

A batch creates a vbscript which creates a lnk
http://www.google.com/[email protected]
hx.gbl

Yet another,

Marty List - shortcut.exe (1.01)
http://www.OptimumX.com
 
M

Mark V

In said:
Your one is (of course) also in my list Mark ;-)
But since Dave already mentioned the link, I listed the other ones.
Oops.
That'll teach me not to skip over posts! <G>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top