r/Batch • • Feb 12 '20

Batch shortcut

Hello,I need help creating a batch shortcut on my Desktop,can somebody upload a batch command ?

0 Upvotes

19 comments sorted by

1

u/jcunews1 Feb 13 '20

No need. You already have all of the commands.

1

u/DramaticYak3260 Feb 13 '20

What do you mean ?

2

u/jcunews1 Feb 13 '20

Batch commands are provided by Windows' built in cmd.exe program. aka. "Command Prompt".

So, if you want to execute the dir command, you'll have to either execute cmd.exe program with a command line switch to specify commands. e.g.

cmd.exe /c dir c:\ & pause

FYI, that is also an example of what you need to type into the Target field of a program shortcut if you want to execute batch commands directly. i.e. via Right-Click > New > Shortcut.

Or... execute cmd.exe program with a command line switch to execute an existing batch file. e.g.

cmd.exe /c "d:\bats\my batch.bat"

1

u/MidgetSpinner64_exe Feb 12 '20

@echo off cd “[location of file]” Start [file name (example: steam.exe)] Exit

0

u/DramaticYak3260 Feb 12 '20

I don't want to open it,I want to create a shortcut :(

1

u/MidgetSpinner64_exe Feb 12 '20

As in a shortcut to a folder?

0

u/DramaticYak3260 Feb 12 '20

On my Desktop

3

u/grizlipiprim Feb 12 '20

Right click on batch file, click on "create shortcut", copy shortcut to desktop.

0

u/DramaticYak3260 Feb 12 '20

I know how to do this I want to do it via commands for an upcoming project :D

4

u/demux4555 Feb 12 '20

let me guess

you want to put a shortcut on someone's desktop named "Firefox", "My Computer", or "Nude babushkas"... to trick someone into executing your deadly virus bat script?

-1

u/DramaticYak3260 Feb 13 '20

No,I want to test how many icons can a Desktop/folder hold without taking too long to open

1

u/Nissingmo Feb 13 '20

So you’re looking for a way to create a shortcut .... through the command line?

3

u/demux4555 Feb 13 '20

he's obviously trying to make someone's system unusable or crash. Probably wants to fill up their desktop with enough icons to make the login bog down to a point where you cannot use the system. If he just wanted to "test how many icons", he can do that by copying files in Explorer.

This is so dumb. Why is this user even still allowed to post here, tbh

2

u/[deleted] Feb 12 '20

@echo off

set SCRIPT="%USERPROFILE%\AppData\Local\Temp\temp.vbs"

echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT% echo sLinkFile = "%USERPROFILE%\Desktop\myshortcut.lnk" >> %SCRIPT% echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT% echo oLink.TargetPath = "%USERPROFILE%" >> %SCRIPT% echo oLink.Save >> %SCRIPT%

cscript /nologo %SCRIPT% del %SCRIPT%

1

u/demux4555 Feb 13 '20

dont feed the troll

5

u/[deleted] Feb 12 '20

[removed] — view removed comment

1

u/[deleted] Apr 22 '20

"oh its you again.

good luck getting help"

like this?

0

u/[deleted] Feb 12 '20

[deleted]

2

u/Nissingmo Feb 13 '20

run it and find out