Solved

Running script at logon

Posted on 2004-04-09
7
275 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
  • 4
  • 2
7 Comments
 
LVL 11

Expert Comment

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

%userprofile%/desktop

happy trails
Chad
0
 

Author Comment

by:goldrhim
Comment Utility
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
Comment Utility
to test it... you can run it from the run command of the users computer.  It should open expolorer with the correct folder.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:goldrhim
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

by Batuhan Cetin Within the dynamic life of an IT administrator, we hold many information in our minds like user names, passwords, IDs, phone numbers, incomes, service tags, bills and the order from our wives to buy milk when coming back to home.…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now