Solved

Running script at logon

Posted on 2004-04-09
7
309 Views
Last Modified: 2010-04-19
Hi there!

I work for a small firm (part time) that has a file server running Server 2003 SBE.  I would like to run a script that would copy a file from a folder on the server to the user's desktop.  The problem is, there are (unfortunately) multiple operating systems that would connect to the network:  98, ME, XP Home, XP Pro.

Is there a standard variable that is the user's desktop (instead of C:\Windows\Desktop and C:\Documents and Settings...).

Sorry if this is a silly question!  I'm a student and still learning!

Thanks,
Tim
0
Comment
Question by:goldrhim
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 11

Expert Comment

by:kabaam
ID: 10791345
Hi goldrhim,
give this one a shot... I think it should do the trick

%userprofile%/desktop

happy trails
Chad
0
 

Author Comment

by:goldrhim
ID: 10791378
Will this work even if the user profiles are local and not on the server?  Users only access the server to get files.

Thanks!
0
 
LVL 11

Expert Comment

by:kabaam
ID: 10791459
to test it... you can run it from the run command of the users computer.  It should open expolorer with the correct folder.
0
Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

 

Author Comment

by:goldrhim
ID: 10791554
Well, it seems to have worked for the XP computer that I'm on now, but the 98 machine, it just created a document called Desktop.  Here's my syntax

copy "E:\File_Database\File_Database.mdb"
"%userprofile%/Desktop"

If I use the syntax you gave me, I get an "invalid syntax" error.  If I use it without the quotes on the last portion, I get the same.
0
 
LVL 6

Accepted Solution

by:
archerslo earned 50 total points
ID: 10795930
As you suggested, this won't work since you're not using roaming profiles and you're using different OS versions.  However, you may want to consider simply copying the file into a particular folder, say "C:\Database\file.mdb", on each workstation, then simply put a shortcut on each Desktop that points to that location.  It's usually a better practice to use shortcuts on the Desktop rather than storing actual data files there anyway.

Archer
0
 
LVL 11

Expert Comment

by:kabaam
ID: 10798058
You can have your script check for the version of windows before copying the file to desktop.
for example

if windows xp copy to ...
if win 98 copy to...
if win ME copy to...

that isn't actual code... just an idea on how it would work
0
 
LVL 11

Expert Comment

by:kabaam
ID: 10798107
this is a copy of a batch file that will determine and display the version of windows you are running.
I got it from a post from Bartender_1, a great expert here at EE.  He says he got it from someone else.
You can edit it to remove the gotos and the echos if need be.  This is a semi clean way of showing how it works.
you can change the winxp section to read
copy filepath\name %userprofile%\desktop
and so on for the other OSs

@ECHO OFF
VER|FIND "XP">NUL
IF NOT ERRORLEVEL 1 GOTO WinXP
VER|FIND "2000">NUL
IF NOT ERRORLEVEL 1 GOTO Win2K
VER|FIND "NT">NUL
IF NOT ERRORLEVEL 1 GOTO WinNT
VER|FIND "Mil">NUL
IF NOT ERRORLEVEL 1 GOTO WinME
VER|FIND "98">NUL
IF NOT ERRORLEVEL 1 GOTO Win98
VER|FIND "95">NUL
IF NOT ERRORLEVEL 1 GOTO Win95
GOTO BADOS

:WinXP
ECHO WinXP
GOTO END

:Win2K
ECHO Win2K
GOTO END

:WinNT
ECHO WinNT
GOTO END

:WinME
ECHO WinME
GOTO END

:Win98
ECHO Win98
GOTO END

:Win95
ECHO Win95
GOTO END

:BADOS
ECHO This OS is not supported
GOTO END

:end

0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This may not be a text book method to resolve VSS backup issues but it seemed to have worked on few of the Windows 2003 servers we had issues while performing a Volume Shadow Copy backup. If you have issues while performing a shadow copy backup usin…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question