Batch file for desktop shortcuts.

I have mapped drives to the NAS.

Sometimes the shortcuts disappear, I've created a batch file the re-maps the drives but don't re-create the shortcuts.

What is the command to create shortcuts?
LVL 1
alonig1Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CompProbSolvCommented:
I usually make copies of the shortcuts in a folder (preferably not on the desktop) and just copy them back.
0
alonig1Author Commented:
That's an idea, the thing is it for someone that has it placed on his desktop at certain locations and I want it to get to that exact place.
0
Ben Personick (Previously QCubed)Lead Network EngineerCommented:
Can you give me a list of paths?
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

alonig1Author Commented:
m:\accounting\bank\file.docx
s:\scan\james\file.pdf
0
Bill PrewCommented:
You might also try creating the shortcuts using the network path rather than the mapped drive.  Might resolve the problem.

For example if M: is mapped to \\server1\share1, and you want to create a shortcut to m:\accounting\bank\file.docx, use \\server1\share1\accounting\bank\file.docx in the shortcut instead.


»bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
alonig1Author Commented:
got it. ill give it a try thanks.
0
CompProbSolvCommented:
You are wanting to specify where on the desktop it ends up?  That's quite a bit trickier.
0
Ben Personick (Previously QCubed)Lead Network EngineerCommented:
Here you are.

 The following batch file will allow you to paste your existing batch file's code into the function titled ":YourCode" and will then create shortcuts (symbolic links) to the files.

  Alternately you might want to make the links to the network path of the files if the shared drives are not much used.

Ben

@(
     SETLOCAL
     ECHO OFF
     SET "_eLvl=0"
     SET "_FileLinks="m:\accounting\bank\file.docx" "s:\scan\james\file.pdf" "
)

CALL :Main

(
    ENDLOCAL
   EXIT /B %_eLvl%
)

:Main

	REM Main Function, Calls other functional Code
	
	CALL :YourCode

	CALL :CreateLinks

GOTO :EOF

:CreateLinks
	REM Code to create links on Current user's desktop:

	FOR %%A IN (%_FileLinks%) DO (
		IF EXIST "%%~A" (
			MKLINK  "%userprofile%\desktop\%%~nxA" "%%~A"
		) ELSE (
			ECHO.ERROR!  The path "%%~A" was not located!  Check to make sure the drive is mapped correctly!
			SET "_eLvl=1"
		)
	)
GOTO :EOF

:YourCode
	REM ===============================================
	REM  Your Existing batch Script to map the drives goes BELOW.
	REM ===============================================



	REM ===============================================
	REM  Your Existing batch Script to map the drives goes ABOVE.
	REM ===============================================
GOTO :EOF

Open in new window

1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
NAS

From novice to tech pro — start learning today.