Jump to content

Help with batch scripting


Recommended Posts


Start menu folders are folders like any other and can be created using the "mkdir" (or "md") command. For instance: to create a "My Apps" folder in the All Users profile Programs folder, use

mkdir "%ALLUSERSPROFILE%\Start Menu\Programs\My Apps"

You can't create shortcuts directly from the command line or a batch file without using a third party program such as XXMKLINK.

Link to comment
Share on other sites

If you do not want to use any third party program. Then you can use a vbs script to make shortcuts. This script leaves a shortcut for notepad and WMP on the user desktop that ran this script. You could have this script start from cmd promt.

Example StartShortCut.cmd

@Echo Off
CLS
Mode 65,7
Color F3
Title Add ShortCuts
Echo.
Echo Preparing To Add Shortcuts To %UserName% Desktop
:: Place The Path To The VBS File Here If It Is Not In The Same Directory As The StartShortCut.cmd
:: start /w PATH_TO_THE_VBS_HERE\ShortCut.vbs
:: This Is For If The VBS And StartShortCut.cmd Are In The Sam Directory start /w ShortCut.vbs
start /w ShortCut.vbs
CLS
Color 3F
Echo.
Echo Completed Adding The Shortcuts To %UserName% Desktop
ping -n 4 127.0.0.1>nul
Exit

Save As ShortCut.vbs

Dim Act,colEnvironmentVariables, objShortCut, Shell
Set Shell = CreateObject("WScript.Shell")
Set colEnvironmentVariables = Shell.Environment("Volatile")
Set Act = CreateObject("Wscript.Shell")

Set objShortCut = Shell.CreateShortcut(Act.ExpandEnvironmentStrings("%UserProfile%\Desktop\Notepad.lnk"))
objShortCut.TargetPath = "Notepad.exe"
objShortCut.Description = "Open Notepad"
objShortCut.HotKey = "Ctrl+Shift+N"
objShortCut.Save

Set objShortCut = Shell.CreateShortcut(Act.ExpandEnvironmentStrings("%UserProfile%\Desktop\Wmp.lnk"))
objShortCut.TargetPath = Act.ExpandEnvironmentStrings("%ProgramFiles%\Windows Media Player\wmplayer.exe")
objShortCut.Description = "Open Windows Media Player 11"
objShortCut.HotKey = "Ctrl+Shift+M"
objShortCut.Save

Edited by gunsmokingman
Link to comment
Share on other sites

the way i do it.. (not the best way, but hella easy i reckon..)

you could use $OEM$ folders, to directly place each one, or just store them on $OEM$\install\shortcuts

then copy c:\install\shortcuts\* %userprofile%\start menu\programs\

etc..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...