need a windows batch file

I want to run an application which requires a network drive to be mapped. and then the executable needs to be run. so i made a simple batch file like

net use Z: "\\computername\shared folder"

now this creates the network mapping, runs the application fine. but the command prompt windows is always open. I just need a batch file that creates the network mapping in the background and just runs the application. this batch file will be made available to users throuch Citrix. so need help in creating a batch file that will make a network mapping, run the .exe and does not keep the command prompt open. it does it transparnatly
Who is Participating?
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.

Mark DamenERP System ManagerCommented:

You can use VBScript instead of a batch file to do these things.

Create a new file called login.vbs in notepad.  Ensure that notepad doesnt append .txt to the end by selecting "All Files" from the type whilst saving.

Paste these lines in:

Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "Z:" , "\\computername\share"

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\notepad "

Simply add a 'start ""' in front of the call to calc.exe (note the empty pair of quotes at the beginning):
start "" "%Systemroot%\system32\calc.exe"

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
mgmohiuddinAuthor Commented:
thanks a lot. the batch file is working but the vb script is giving an error appreciate if you could just verift it once. line two char 1 error.
mgmohiuddinAuthor Commented:
Ok the VB script is giving an error if the network mapping is already there. for example i run the script for the first time, it runs fine. it opens the application and also maps the drive. the second time i run this script gives me an error as the mapping is already there. it needs to create a mapping only if it is not there already. so maybe just need to modify the vb script slightly. thanks
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
Windows Batch

From novice to tech pro — start learning today.