bat脚本创建网站url格式的快捷方式
时间: 2023-10-15 11:04:27 浏览: 58
你可以使用以下代码创建一个.bat文件来创建网站的快捷方式:
```batch
@echo off
set /p url="请输入网站地址: "
set /p name="请输入快捷方式名称: "
set shortcut="%userprofile%\Desktop\%name%.url"
echo [InternetShortcut]>> %shortcut%
echo URL=%url%>> %shortcut%
echo IconFile=%programfiles%\Internet Explorer\iexplore.exe>> %shortcut%
echo IconIndex=1>> %shortcut%
echo Created %shortcut% successfully!
pause
```
在运行.bat文件时,它将提示您输入网站地址和快捷方式名称。然后,它将在桌面上创建一个名为“name.url”的网站快捷方式,其中URL为您输入的网站地址。该快捷方式将使用Internet Explorer的图标。
相关问题
bat脚本创建快捷方式
你可以使用以下的bat脚本代码来创建快捷方式:
```batch
set WshShell = CreateObject("WScript.Shell")
set oShellLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\YourShortcut.lnk")
oShellLink.TargetPath = "C:\Path\To\Your\Program.exe"
oShellLink.Save
```
将上述代码保存为一个 .bat 文件,然后执行该文件即可创建一个名为 YourShortcut 的快捷方式,它位于 C:\Users\Public\Desktop 目录下,并指向 C:\Path\To\Your\Program.exe。你可以根据需要修改路径和文件名。
win7系统使用bat脚本创建指定文件快捷方式
您可以使用以下的bat脚本代码来创建指定文件的快捷方式:
```
@echo off
set shortcut="C:\Users\%username%\Desktop\shortcut.lnk"
set target="C:\path\to\file\filename.txt"
set wshShell = CreateObject("WScript.Shell")
set oShellLink = wshShell.CreateShortcut(shortcut)
oShellLink.TargetPath = target
oShellLink.Save
echo Shortcut created!
```
请将 `C:\path\to\file\filename.txt` 替换为您要创建快捷方式的文件的路径和名称,同时将 `C:\Users\%username%\Desktop\shortcut.lnk` 替换为您想要创建的快捷方式的路径和名称。