How to create a batch file to create a shortcut on a web page

I want to create a batch file that creates a shortcut on the desktop or the start menu.

In the shortcut you need to open the web page, which is the local IP address of the Windows server (for example, "http: \ 192.168 .. * : 81 \ ').

I also want to provide a custom image icon for the shortcut.

+2
source share
5 answers

I know this is an old thread, but it was the first StackOverFlow page that appeared on Google, so I thought I would make an answer.

script, URL: ( , script , - MyIconName.ico - , script. , )

, ...

@echo off 
@echo. 
@echo.
@echo.

::Set the application-specific string vars 
SET AppDescription=MyAppName
SET IconName=MyIconName.ico
SET Shortcut_Name=MyShortcutName.url
SET URL_PATH=http://www.Google.com

::Set the common string vars 
SET WORKING_PATH=%~dp0
SET ICONDEST=c:\ProgramData\%AppDescription%
SET LinkPath=%userprofile%\Desktop\%Shortcut_Name%

@echo. Copy Icon 
IF EXIST "%ICONDEST%" (GOTO _CopyIcon) 
mkdir "%ICONDEST%"
:_CopyIcon 
copy "%WORKING_PATH%%IconName%" "%ICONDEST%"

echo. 
echo. Create desktop shortcut... 
echo [InternetShortcut] > "%LinkPath%"
echo URL=%URL_PATH% >> "%LinkPath%"
echo IDList= >> "%LinkPath%"
echo IconFile=%ICONDEST%\%IconName% >> "%LinkPath%"
echo IconIndex=0 >> "%LinkPath%"
echo HotKey=0 >> "%LinkPath%"
echo. 
echo. 
echo. 
echo. 
echo.You should now have a shortcut to %AppDescription% on your desktop... 
echo. 
echo. 
pause 
+5

Mozilla Firefox

start/MIN/d "C:\Program Files\Mozilla Firefox" firefox.exe http://www.yourlink.com

Google Chrome

start/MIN/d "C:\Program Files\Google Chrome" chrome.exe http://www.yourlink.com

+1

/. :

  • VBScript,
0

, :

echo start http://192.168.1.1:81 > "%userprofile%\desktop\Launch website.cmd"

, . ( ), , , , , .

There is not enough information in your description about the problem you are trying to solve, but if this is really what you are saying, you can also just create a shortcut once, manually, and then use the batch file to copy this shortcut to where you wanted it.

Please add more details to your question if we are missing a boat here ...

0
source

Source: https://habr.com/ru/post/1658427/


All Articles