當前位置:首頁 » 編程軟體 » 創建快捷方式腳本

創建快捷方式腳本

發布時間: 2022-08-20 01:06:13

① 如何創建快捷方式有幾種辦法

創建快捷方式有兩種:

第一種

1、找到要創建快捷方式的文件,選中。

② 用bat創建快捷方式的方法。

1樓
方式一創建的「畫圖.url」在XP中運行時提示「該文件沒有程序與之關聯。。。。。」

比較方便實用的兩種方法如下:

直接生成BAT調用文件的批處理代碼如下:
@echo>"%USERPROFILE%\桌面\123.bat" @start "" "%cd%\123.txt"

調用VBS生成快捷方式的批處理代碼如下:
@echo off
set shortCutPath="%USERPROFILE%\桌面\123.lnk"
set file=%cd%\123.txt
(echo Dim WshShell,Shortcut
echo Dim path,fso
echo path="%file%"
echo Set fso=CreateObject^("Scripting.FileSystemObject"^)
echo Set WshShell=WScript.CreateObject^("WScript.Shell"^)
echo Set Shortcut=WshShell.CreateShortCut^(%shortCutPath%^)
echo Shortcut.TargetPath=path
echo Shortcut.Save
)>tmp.vbs
start /wait "" tmp.vbs
del /f/q tmp.vbs

③ 如何使用 Windows 腳本宿主創建桌面快捷方式

如何使用 Windows 腳本宿主創建桌面快捷方式
電子郵件
列印
注意:這篇文章是由無人工介入的微軟自動的機器翻譯軟體翻譯完成。微軟很高興能同時提供給您由人工翻譯的和由機器翻譯的文章, 以使您能使用您的語言訪問所有的知識庫文章。然而由機器翻譯的文章並不總是完美的。它可能存在詞彙,語法或文法的問題,就像是一個外國人在說中文時總是可能犯這樣的錯誤。雖然我們經常升級機器翻譯軟體以提高翻譯質量,但是我們不保證機器翻譯的正確度,也不對由於內容的誤譯或者客戶對它的錯誤使用所引起的任何直接的, 或間接的可能的問題負責。

點擊這里察看該文章的英文版: 244677
概要
Microsoft Windows 腳本宿主 (WSH) 是一種工具,使您可以運行 Microsoft Visual Basic 腳本版本和 JScript 本身內基本操作系統,Windows 95 或 Windows NT 4.0 上。它還包括了多個 COM 自動化方法,您可以執行多項任務很容易地通過 Windows 腳本宿主對象模型。Microsoft Windows 腳本宿主集成到 Windows 98、 Windows 2000 和更高版本的 Windows 操作系統。它可用於為 Windows NT 4.0 安裝了 Windows NT 4.0 選項包。若要下載此工具,請訪問下面的 Microsoft 開發人員網路 (MSDN) Web 站點 ︰
http://msdn2.microsoft.com/en-us/library/ms950396.aspx
詳細信息
這個程序演示了如何使用 Windows 腳本宿主可以在 Windows 桌面上創建一個快捷方式。為了運行此示例,您必須在您的計算機上安裝 Windows 腳本宿主。若要運行這些示例,請將下面的代碼復制到一個新的程序文件,並運行它。
示例 1

WshShell = CreateObject("Wscript.shell")
strDesktop = WshShell.SpecialFolders("Desktop")
oMyShortcut = WshShell.CreateShortcut(strDesktop + "\Sample.lnk")
oMyShortcut.WindowStyle = 3 &&Maximized 7=Minimized 4=Normal
oMyShortcut.IconLocation = "C:\myicon.ico"
OMyShortcut.TargetPath = "%windir%\notepad.exe"
oMyShortCut.Hotkey = "ALT+CTRL+F"
oMyShortCut.Save

示例 2
(添加命令行參數)

WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
oMyShortCut= WshShell.CreateShortcut(strDesktop+"\Foxtest.lnk")
oMyShortCut.WindowStyle = 7 &&Minimized 0=Maximized 4=Normal
oMyShortcut.IconLocation = home()+"wizards\graphics\builder.ico"
oMyShortCut.TargetPath = "c:\Program Files\Microsoft Visual Studio\VFP98\vfp6.exe"
oMyShortCut.Arguments = '-c'+'"'+Home()+'config.fpw'+'"'
oMyShortCut.WorkingDirectory = "c:\"
oMyShortCut.Save

注意:根據您正在使用的 Visual FoxPro 的版本,您可能需要更改名稱和 Visual FoxPro 示例 2 中的可執行文件的路徑。
示例 3
(將 URL 快捷方式添加到桌面)

WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
oUrlLink = WshShell.CreateShortcut(strDesktop+"\Microsoft Web Site.URL")
oUrlLink.TargetPath = "http://www.microsoft.com"
oUrlLink.Save

注意:要創建的快捷方式,必須對所有方法傳遞有效參數。如果其中一個參數不正確,會不出現任何錯誤。
引用
有關其他信息,查找 Microsoft 開發人員網路 (MSDN) 網站上的以下引用 ︰
http://msdn2.microsoft.com/en-us/library/ms950396.aspx
白皮書 ︰
Windows 腳本宿主 ︰ 通用腳本主機腳本語言

技術白皮書 ︰
Windows 腳本主機程序員參考
警告:本文已自動翻譯
屬性
文章 ID:244677 - 上次審閱時間:08/27/2007 05:54:22 - 修訂版本: 3.6
這篇文章中的信息適用於:
Microsoft Visual FoxPro 3.0 標准版
Microsoft Visual FoxPro 3.0b 標准版
Microsoft Visual FoxPro 5.0 標准版
Microsoft Visual FoxPro 5.0a
Microsoft Visual FoxPro 6.0 專業版
Microsoft Visual FoxPro 7.0 Professional Edition
Microsoft Visual FoxPro 8.0 專業版
Microsoft Visual FoxPro 9.0 Professional Edition
關鍵字:
kbmt kbhowto kbmisctools kbscript KB244677 KbMtzh

④ 如何用Bat文件創建桌面快捷方式。

批處理創建快捷方式的四種方法

方法一,url式的快捷方式
echo [InternetShortcut] >>"%USERPROFILE%\桌面\畫圖.url"
echo URL="%SystemRoot%\system32\mspaint.exe" >>"%USERPROFILE%\桌面\畫圖.url"
echo IconIndex=0 >>"%USERPROFILE%\桌面\畫圖.url"
echo IconFile="%SystemRoot%\system32\mspaint.exe" >>"%USERPROFILE%\桌面\畫圖.url"

方法二,外部命令
shortcut.exe /f:"%USERPROFILE%\桌面\畫圖.lnk" /a:c /t:"%SystemRoot%\system32\mspaint.exe"
shutcut可以在本論壇上下載,同樣希望高手給補充一下為快捷方式添加說明的代碼

方法三,VBScript腳本
@echo
set shortCutPath="%USERPROFILE%\桌面\畫圖.lnk"
echo Dim WshShell,Shortcut>>tmp.vbs
echo Dim path,fso>>tmp.vbs
echo path="%SystemRoot%\system32\mspaint.exe">>tmp.vbs
echo Set fso=CreateObject("Scripting.FileSystemObject")>>tmp.vbs
echo Set WshShell=WScript.CreateObject("WScript.Shell")>>tmp.vbs
echo Set Shortcut=WshShell.CreateShortCut(%shortCutPath%)>>tmp.vbs
echo Shortcut.TargetPath=path>>tmp.vbs
echo Shortcut.Save>>tmp.vbs
"%SystemRoot%\System32\WScript.exe" tmp.vbs
@del /f /s /q tmp.vbs
pause

方法四,winrar
@echo off
echo Path=%%SystemRoot%%\system32\>test.txt
echo Silent=^2>>test.txt
echo Overwrite=^1>>test.txt
echo Shortcut=D, "mspaint.exe", "\", "創建和編輯圖畫,以及顯示和編輯掃描獲得的圖片。", "圖畫">>test.txt
start /wait winrar.exe a -r -ep1 -m1 -sfx -ztest.txt test.exe %SystemRoot%\system32\mspaint.exe
start /wait test.exe
del test.*

熱鍵和數值的對應關系
833 - ctrl + shift + a
834 - ctrl + shift + b
835 - ctrl + shift + c
836 - ctrl + shift + d
837 - ctrl + shift + e
838 - ctrl + shift + f
.
.
1601 - ctrl + alt + a
1602 - ctrl + alt + b
1603 - ctrl + alt + c
1604 - ctrl + alt + d
1605 - ctrl + alt + e
1606 - ctrl + alt + f

⑤ 用BAT創建快捷方式到桌面

批處理創建快捷方式的四種方法

方法一,url式的快捷方式
echo [InternetShortcut] >>"%USERPROFILE%\桌面\畫圖.url"
echo URL="%SystemRoot%\system32\mspaint.exe" >>"%USERPROFILE%\桌面\畫圖.url"
echo IconIndex=0 >>"%USERPROFILE%\桌面\畫圖.url"
echo IconFile="%SystemRoot%\system32\mspaint.exe" >>"%USERPROFILE%\桌面\畫圖.url"

方法二,外部命令
shortcut.exe /f:"%USERPROFILE%\桌面\畫圖.lnk" /a:c /t:"%SystemRoot%\system32\mspaint.exe"
shutcut可以在本論壇上下載,同樣希望高手給補充一下為快捷方式添加說明的代碼

方法三,VBScript腳本
@echo
set shortCutPath="%USERPROFILE%\桌面\畫圖.lnk"
echo Dim WshShell,Shortcut>>tmp.vbs
echo Dim path,fso>>tmp.vbs
echo path="%SystemRoot%\system32\mspaint.exe">>tmp.vbs
echo Set fso=CreateObject("Scripting.FileSystemObject")>>tmp.vbs
echo Set WshShell=WScript.CreateObject("WScript.Shell")>>tmp.vbs
echo Set Shortcut=WshShell.CreateShortCut(%shortCutPath%)>>tmp.vbs
echo Shortcut.TargetPath=path>>tmp.vbs
echo Shortcut.Save>>tmp.vbs
"%SystemRoot%\System32\WScript.exe" tmp.vbs
@del /f /s /q tmp.vbs
pause

方法四,winrar
@echo off
echo Path=%%SystemRoot%%\system32\>test.txt
echo Silent=^2>>test.txt
echo Overwrite=^1>>test.txt
echo Shortcut=D, "mspaint.exe", "\", "創建和編輯圖畫,以及顯示和編輯掃描獲得的圖片。", "圖畫">>test.txt
start /wait winrar.exe a -r -ep1 -m1 -sfx -ztest.txt test.exe %SystemRoot%\system32\mspaint.exe
start /wait test.exe
del test.*

熱鍵和數值的對應關系
833 - ctrl + shift + a
834 - ctrl + shift + b
835 - ctrl + shift + c
836 - ctrl + shift + d
837 - ctrl + shift + e
838 - ctrl + shift + f
.
.
1601 - ctrl + alt + a
1602 - ctrl + alt + b
1603 - ctrl + alt + c
1604 - ctrl + alt + d
1605 - ctrl + alt + e
1606 - ctrl + alt + f

⑥ 就是怎麼用命令提示符或者bat等處理文件來創建某文件的快捷方式

其實就一條命令:(保存為bat格式,注意:有兩個and希臘字母 && )
cmd /k "cd /d Your ProjectPath&&Your CMD command"

舉例:
1、在電腦桌面,新建txt文本。
2、把下面一行復制到txt文本中,並改為您的路徑和命令:
cmd /k "cd /d D:\Program Files\Project\bin&&You cmd Command Line"
3、把文本的後綴名txt改為bat
4、雙擊bat文件即可。

注意:
1、多條命令請用兩個希臘字母(and)&& 鏈接 :
(如:
cmd /k "cd /d D:\test&&cd ProName&&c:"
運行後:
C:\Users\youname\Desktop> cmd /k "cd /d D:\test&&cd ProName&&c:"
C:\Users\youname\Desktop>
意思是:走到了D盤下test文件夾再進入test中ProName文件夾中再到C盤。)
2、例如:我的桌面上mysql,(mysql.bat)中命令:
cmd /k "cd /d D:\Program Files\MySQL\bin&&mysql -uroot -p"
雙擊文件:
C:\Users\Gengo-qinggz\Desktop>
C:\Users\huishusheng\Desktop>
C:\Users\We_ChatGZNumber\Desktop>cmd /k "cd /d D:\Program Files\MySQL\bin&&mysql -uroot -p"
Enter password: _

(我的命令會到mysql的bin中,密碼輸入位置。)
3、可以把圖標換為黑色命令圖標[C:\_],一眼就知道是批處理命令文件。(換圖標方法:屬性-更改圖標-瀏覽-搜索:cmd -找到cmd.exe-打開-確定)
如果一次運行多行命令,請用 && 連接(勿帶空格,勿換行)進行處理。

⑦ 批處理 創建快捷方式

批處理創建快捷方式方法:
一、示例為創建記事本的快捷方式到桌面。
set path=%WINDIR%\notepad.exe。
set
topath="%USERPROFILE%\桌面\記事本.url"。
echo [InternetShortcut] >>
%topath%。
echo URL="%path%" >> %topath%。
echo IconIndex=0 >>
%topath%。
echo IconFile=%path% >> %topath%。
二、利用批處理創建桌面快捷方式。
goto :eof
Rem 以下為VbScript腳本。
Set WshShell =
WScript.CreateObject("WScript.Shell")。
strDesktop =
WshShell.SpecialFolders("Desktop") :'特殊文件夾「桌面」。
Rem 在桌面創建一個記事本快捷方式。
set oShellLink = WshShell.CreateShortcut(strDesktop &
"\記事本.lnk")。
oShellLink.TargetPath = "notepad.exe" : 目標。
oShellLink.WindowStyle = 3 :'參數1默認窗口激活,參數3最大化激活,參數7最小化。
oShellLink.Hotkey = "Ctrl+Alt+e" :
'快捷鍵。
oShellLink.Ic : '圖標。
oShellLink.Description = "記事本快捷方式" :
'備注。
oShellLink.WorkingDirectory = strDesktop : '起始位置。
oShellLink.Save :
'創建保存快捷方式。
Rem 在桌面創建一個 騰訊QQ 2007。
set oShellLink =
WshShell.CreateShortcut(strDesktop & "\騰訊QQ 2007
.lnk")
oShellLink.TargetPath = "D:\Tencent\QQ\QQ.exe" :
'目標。
oShellLink.WindowStyle = 3
:'參數1默認窗口激活,參數3最大化激活,參數7最小化。
oShellLink.Hotkey = "Ctrl+Alt+q" :
'快捷鍵。
oShellLink.Ic : '圖標。
oShellLink.Description = "騰訊QQ 2007" :
'備注。
oShellLink.WorkingDirectory = strDesktop : '起始位置。
oShellLink.Save :
'創建保存快捷方式。
Rem 在桌面創建一個「微軟中國」的Url快捷方式。
set oUrlLink =
WshShell.CreateShortcut(strDesktop & "\網路搜索.url")。
oUrlLink.TargetPath =
"http://www..com/"。
oUrlLink.Save。
三、批處理桌面創建快捷方式。
EXE型:
S bat
echo off & cls
echo create_shortcut
start wscript -e:vbs
"%~f0"。

Set WshShell = WScript.CreateObject("WScript.Shell")。
strDesktop =
WshShell.SpecialFolders("Desktop")。
set oShellLink =
WshShell.CreateShortcut(strDesktop & "\QQ.lnk")。
oShellLink.TargetPath =
"d:\QQ\QQ.exe"。
oShellLink.WindowStyle = 3。
oShellLink.Hotkey =
"Ctrl+Alt+e"。
oShellLink.IconLocation = "d:\QQ\QQ.exe,
0"。
oShellLink.Description = "快捷方式"。
oShellLink.WorkingDirectory =
"d:\QQ"。
oShellLink.Save。
IP型:
S bat
echo off & cls
echo create_shortcut
start wscript -e:vbs
"%~f0"。
Exit S
End S
Set WshShell = WScript.CreateObject("WScript.Shell")。
strDesktop =
WshShell.SpecialFolders("Desktop")。
set oShellLink =
WshShell.CreateShortcut(strDesktop & "\學習天地.lnk")。
oShellLink.TargetPath = "http://lxxxxxxx:81"。
oShellLink.WindowStyle = 3
oShellLink.Hotkey = "Ctrl+Alt+e"。
oShellLink.IconLocation =
"%SystemRoot%\system32\url.dll, 0"。
oShellLink.Description =
"快捷方式"。
oShellLink.WorkingDirectory = "C:\Program Files\Internet
Explorer"。
oShellLink.Save。

熱點內容
java可執行文件 發布:2025-02-06 17:18:59 瀏覽:247
衛士相當於現在什麼配置 發布:2025-02-06 17:05:04 瀏覽:409
項目編譯慢 發布:2025-02-06 16:53:48 瀏覽:382
python處理excel文件 發布:2025-02-06 16:36:09 瀏覽:442
演算法相對定位 發布:2025-02-06 16:32:42 瀏覽:728
java程序的編譯和執行 發布:2025-02-06 16:21:45 瀏覽:420
什麼是淘寶帳號和密碼 發布:2025-02-06 16:21:36 瀏覽:498
解壓前面簽 發布:2025-02-06 16:02:00 瀏覽:326
華碩訪問點 發布:2025-02-06 15:56:57 瀏覽:333
excel拼接sql 發布:2025-02-06 15:50:10 瀏覽:503