Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script Help 1

Status
Not open for further replies.

SchoolIT

IS-IT--Management
Dec 16, 2004
10
0
0
US
Hello, I administer a county school here in Florida with 200 nodes. We use a NT4 PDC server(not for long) and have a mixture of XP and 98(slowly upgrading).

I wanted to know if anybody knew a logon script that can, **Map a network share folder **Create a desktop Icon of the .exe inside the share for the students when they log in?

The software I am using is a for learning and designed to work on a network, but I was trying to avoid walking to every class and creating share/icon.

Thank you all for your help and time.
 
Here's an option. Say you want to use Q: as the mapped drive. Map a drive on your local machine to Q: and create a shortcut to Q:\application.exe. Save this shortcut in Q:.

For you login script, try something like this:

Net use q: \\servername\sharename
copy q:\shortcut.lnk %userprofile%\desktop

I haven't used a Win98 machine in a long time, so check to make sure this parameter works.
 
I will try it.

In the line "copy q:\shortcut.lnk %userprofile%\desktop" do I have to replace userprofile to the user or leave as is?

Thanks.
 
Leave it as it is. %userprofile% is an environment variable and will be replaced with the current profile path. Go to a command prompt and type "echo %userprofile%" (without the quotes) and hit enter. The userprofile environment variable will be displayed. To see what else can be used in your batch file, go to a command prompt and type SET and hit enter.
 
dk87,

I tried it and the mapping worked well on both XP and 98 but the shortcut did not. Could it be the syntax?

This is my script.

@echo off
net use P: \\Server\Blaster
copy P:\Blast.exe %userprofile%\desktop

Thanks for the help.
 
Syntax looks OK, change as follows:-

@echo off
net use P: \\Server\Blaster
copy P:\Blast.exe %userprofile%\desktop
pause

run the batch file manually on one of the clients and see what if any error is returned.

-------------------------------

If it doesn't leak oil it must be empty!!
 
Ok,

This is the error;

"CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to Windows directory. System error 85 has occurred. The syntax of the command is incorrect. Press any key to continue..."

It maps the drive but doesn't create the shortcut?

Thank You for the help.
 
Try this:
@echo off
net use P: \\Server\Blaster
C:
cd\
copy P:\Blast.exe %userprofile%\desktop

 
Ok, now I just get this error: " The syntax of this command is incorrect."

Thank you for the help
 
My bad. You need the quotes if there is a space in the path. By the way, you are copying a program, not a shortcut.

@echo off
net use P: \\Server\Blaster
C:
cd\
copy P:\Blast.exe "%userprofile%\desktop
 
BEAUTIFUL! It works! Thanks a million guys.

I'm not using an actual .exe it's a txt file i named and put .exe to test. .


THANK YOU..!
 
I'm sorry I didn't try it on the 98 machines. It works perfect on the XP machines but on the 98 it stays stuck in "Please wait while your logon script executes" until you hit cancel.

:( 50% there so far!

THank you so much for the help!
 
log onto a 98 machine, go to a command prompt, type SET and hit enter. See what environment variable are there. Sorry, I have no more 95 or 98 machines so I cannot try it. Chances are that %userprofile% does not exist. Anyway, look for something you can use to differentiate between the 98 machines and XP machines. Try %windir% for example. On the XP machines it is probably C:\WINNT and on the 98 machines it is probably C:\WINDOWS. On a Windows 98 machine you need to copy your settings to a different folder (I am assuming C:\Windows\Desktop but double-check that). So using that as an example:

@echo off
net use P: \\Server\Blaster
C:
cd\
If %WINDIR% == C:\WINNT goto skipit
copy P:\Blast.exe c:\Windows\Desktop
goto done
:skipit
copy P:\Blast.exe "%userprofile%\desktop"
:done

 
Correction:

@echo off
net use P: \\Server\Blaster
C:
cd\
If %WINDIR% == C:\WINNT goto skipit
copy P:\Blast.exe %WINDIR%\Desktop
goto done
:skipit
copy P:\Blast.exe "%userprofile%\desktop"
:done

Keep in mind that the %WINDIR% comparison in the IF statement is only to differentiate between Win98 and WinXP, but the one in the copy statement is to determine where to place the file. That way if one Win98 machine has its windows directory as WINDOWS and another has it as WIN98, they will both work.
 
OK, I will try it Monday when i get back to work. Thanks for the help!!! :)
 
OK,

When you put %WINDIR% is this to replace with something else or is that literall?

The SET command in 98 has Windir=C:\Windows

The SET command in XP has Windir=C:|Windows also.

I beleive I need to look for something that shows on both but is a different path. I see that both have a Temp=C:\...

Win98 has Temp=C:\windows\TEMP
WinXP has Temp=C:\Docume\Adm\Loca|...

Not sure if I understood your question.

Thank you for your time.
 
Referring only to the IF statement - the purpose of %WINDIR% is to try to differentiate between machines running Win98 and those running XP. So if they both have C:\Windows then it does not work, and you need to find something else to use.
No matter what you use to differentiate the OS's with, keep the %WINDIR% in the copy command exactly like it is, as the purpose of this is to tell the machine where to copy the file to.
 
Hopefully "issue resolved" is the reason this thread has been dormant 40+ days, but if not...

I'm pretty sure %OS% is the env variable that could differentiate 98 from XP from NT. I don't have 98 or NT boxes, so I can't check either.

\me heads out to create his own desperate post...
 
No, I havent been able to get this to work. I cant get it to differ from Win98 and XP on a script.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top