Windows 10: Can't Create Shortcut - Windows 11 is Confusing a Directory with a *.bat File of the Same Name.

Discus and support Can't Create Shortcut - Windows 11 is Confusing a Directory with a *.bat File of the Same Name. in Windows 10 Software and Apps to solve the problem; I have a directory called "test1" In that directory I also have a *.bat file called test1.bat.When I try to create a shortcut to the directory test1 -... Discussion in 'Windows 10 Software and Apps' started by Coupled Resonators, Jan 25, 2025.

  1. Can't Create Shortcut - Windows 11 is Confusing a Directory with a *.bat File of the Same Name.


    I have a directory called "test1" In that directory I also have a *.bat file called test1.bat.When I try to create a shortcut to the directory test1 - Windows thinks, assumes, that I'm creating a shortcut to the file called test1.bat. There doesn't seem to be a reasonable way to fix this. I'm stuck.I'm using Windows 11 Pro - and Explorer of course

    :)
     
    Coupled Resonators, Jan 25, 2025
    #1

  2. Creating Shortcuts with Batch File

    Threw a program together quick for you. It is attached with source in the other. Use it in place of your VBScript.

    It supports:
    CreateShortcut [save shortcut] [path to run]
    CreateShortcut [save shortcut] [path to run] [icon index]
    CreateShortcut [save shortcut] [path to run] [icon file]
    CreateShortcut [save shortcut] [path to run] [icon file] [icon index]

    If "icon index" is missing, it assumes 0. If "icon file" is missing it assumes "path to run." It doesn't presently support arguments to be added to the shortcut nor modifying the working directory (always assumes same directory as "path to run").

    Requires .NET Framework 4.0 to run. Will run natively on 32-bit and 64-bit versions of Windows.
     
    FordGT90Concept, Jan 25, 2025
    #2
  3. Flava0ne Win User
    Creating Shortcuts with Batch File

    No error, when I run the BAT file the CMD prompt shows and looks like it did stuff. But no shortcut on my Desktop.
     
    Flava0ne, Jan 25, 2025
    #3
  4. Flava0ne Win User

    Can't Create Shortcut - Windows 11 is Confusing a Directory with a *.bat File of the Same Name.

    Creating Shortcuts with Batch File

    I've created a Batch file which calls on the following VB Script to be able to create a shortcut to my desktop:

    VB Script (named createLink.vbs):
    Code: set objWSHShell = CreateObject("WScript.Shell") set objFso = CreateObject("Scripting.FileSystemObject") ' command line arguments ' TODO: error checking sShortcut = objWSHShell.ExpandEnvironmentStrings(WScript.Arguments.Item(0)) sTargetPath = objWSHShell.ExpandEnvironmentStrings(WScript.Arguments.Item(1)) sWorkingDirectory = objFso.GetAbsolutePathName(sShortcut) set objSC = objWSHShell.CreateShortcut(sShortcut) objSC.TargetPath = sTargetPath objSC.WorkingDirectory = sWorkingDirectory objSC.Save[/quote] Batch File Example (for Windows Notepad):
    Code: @Echo off cscript createLink.vbs "C:\Users\Administrator\Desktop\Notepad.lnk" "C:\Windows\System32\notepad.exe"[/quote] But after creating the shortcut using this method, I'm not able to assign a custom icon for the shortcut. I get the following error message when trying to do so:


    Can't Create Shortcut - Windows 11 is Confusing a Directory with a *.bat File of the Same Name. [​IMG]


    Any help and ideas on what I need to put into the VB Script and/or Batch File to be able to do this would be greatly appreciated! *Big Grin Can't Create Shortcut - Windows 11 is Confusing a Directory with a *.bat File of the Same Name. :D

    Also, I know that I can simply do this by going to Start Menu\All Programs\Accessories\ right-clicking on Notepad and selecting Send to\Desktop (create shortcut). Easy enough for creating a single shortcut. But I need to create several multiple shortcuts and using this Batch/VBS method would really save me a lot of time in doing so.
     
    Flava0ne, Jan 25, 2025
    #4
Thema:

Can't Create Shortcut - Windows 11 is Confusing a Directory with a *.bat File of the Same Name.

Loading...
  1. Can't Create Shortcut - Windows 11 is Confusing a Directory with a *.bat File of the Same Name. - Similar Threads - Can't Create Shortcut

  2. Can't Create Shortcut - Windows 11 is Confusing a Directory with a *.bat File of the Same Name.

    in Windows 10 Gaming
    Can't Create Shortcut - Windows 11 is Confusing a Directory with a *.bat File of the Same Name.: I have a directory called "test1" In that directory I also have a *.bat file called test1.bat.When I try to create a shortcut to the directory test1 - Windows thinks, assumes, that I'm creating a shortcut to the file called test1.bat. When I double click the shortcut...
  3. Pin bat file Shortcut to Windows 11 taskbar

    in Windows 10 Gaming
    Pin bat file Shortcut to Windows 11 taskbar: I'm trying to pin app shortcuts to the W11 taskbar. I've managed to pin all apps to the bar except a shortcut to a bat file. Shortcuts to other apps can be pinned. It won't work and I wonder why??...
  4. Pin bat file Shortcut to Windows 11 taskbar

    in Windows 10 Software and Apps
    Pin bat file Shortcut to Windows 11 taskbar: I'm trying to pin app shortcuts to the W11 taskbar. I've managed to pin all apps to the bar except a shortcut to a bat file. Shortcuts to other apps can be pinned. It won't work and I wonder why??...
  5. Is it possible to create a file with the same name in the same exact directory?

    in Windows 10 Gaming
    Is it possible to create a file with the same name in the same exact directory?: Hi, I am trying to figure out how to create a file with the same name in the same directory. Purely for educational purposes and to experiment around Is there a way to do this? For example: a special character or a command prompt/PowerShell trick. Thanks!...
  6. Is it possible to create a file with the same name in the same exact directory?

    in Windows 10 Software and Apps
    Is it possible to create a file with the same name in the same exact directory?: Hi, I am trying to figure out how to create a file with the same name in the same directory. Purely for educational purposes and to experiment around Is there a way to do this? For example: a special character or a command prompt/PowerShell trick. Thanks!...
  7. Is it possible to create a file with the same name in the same exact directory?

    in Windows 10 Network and Sharing
    Is it possible to create a file with the same name in the same exact directory?: Hi, I am trying to figure out how to create a file with the same name in the same directory. Purely for educational purposes and to experiment around Is there a way to do this? For example: a special character or a command prompt/PowerShell trick. Thanks!...
  8. Help Creating "Drag & Drop" .bat file to Append File Names

    in Windows 10 Support
    Help Creating "Drag & Drop" .bat file to Append File Names: I have been attempting to come up with a way to be able to drag and drop a file to append 3 letters to it. The issue is that the extent of my programming knowledge lies in VBA and not much else. While I could probably make it work in VBA, I'd prefer to not require the...
  9. Can't save a file with the same name as a folder in the same directory

    in Windows 10 Network and Sharing
    Can't save a file with the same name as a folder in the same directory: So lets say I want to save my excel file to my documents folder. I want to name the file "data", but there is already a folder with the name data in the documents directory. When I type the word "data" into "File name:" and hit save, the file explorer opens up the data folder...
  10. Not able to launch certain .exe files with created .bat shortcuts

    in Windows 10 Support
    Not able to launch certain .exe files with created .bat shortcuts: Hello, To be able to use custom tiles on the Start Menu, I make .bat files of .exe files to use them as shortcuts to launch the .exe files. I make the .bat file by opening Notepad, pasting the directory path of the .exe file in quotes, and then save it as a .bat file. This...