Making CMD Shortcut with WSF

This is one of computer trick. It’s easy to implement. The concept is to use the JS (Java Script) to make a shortcut in the start menu or the drive&folder of windows explorer. Here are the steps how to make a simple program to generate shortcut in those place.

1. Open Notepad from Start Menu > All Programs > Accessories.

2. Type all of this scripts into the Notepad:
var vbCancel = 2;
var vbYesNoCancel = 3;
var vbYes = 6;
var vbNo = 7;
var vbQuestion = 32;
var vbInformation = 64;
var natan = WScript.CreateObject(‘WScript.Shell’);
var pesan1 = ‘Pilihan Buka Command:\n\n’+
‘[Yes] untuk Install.\n’+
‘[No] untuk UnInstall.\n’+
‘[Cancel] untuk Keluar.\n\n’+
‘[Bangkitlah TI Indonesia!]\n\n’+
‘-> Install sekarang?’
var tanya = natan.popup( pesan1,0,’Buka Command’,
if (tanya == vbYes)
natan.RegWrite( ‘HKCR\\Directory\\shell\\tan\\’,
‘-> Buka Command!’,’REG_SZ’);
natan.RegWrite( ‘HKCR\\Directory\\shell\\tan\\command\\’,
natan.RegWrite( ‘HKCR\\Drive\\shell\\tan\\’,
‘-> Buka Command!’,’REG_SZ’);
natan.RegWrite( ‘HKCR\\Drive\\shell\\tan\\command\\’,
pesan2 = ‘Selesai Di Install!’
natan.popup(pesan2,0,’Buka Command’,vbInformation);
else if (tanya == vbNo)
pesan3 = ‘Selesai Di UnInstall!’
natan.popup(pesan3,0,’Buka Command’,vbInformation);
natan.popup(‘Matur Nuwun.’,0,’Buka Command’,vbInformation);

3. Save it with the name shortcmd.js. Don’t forget to change the Save as type option from Text Document(*.txt) became All Files(*.*).

4. Execute the program from the command prompt by typing command cscript shortcmd.js.

5. When the program windows appear, click the Yes button to Install the shortcut. If you want to uninstall it, click the No Button. Simple isn’t it?

6. Finally, right click on the start menu button or the drive&folder of windows explorer then choose “-> Buka Command!”. The command prompt will appear by it self and ready to use.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: