Windows 10: VBScript: Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start...

Discus and support VBScript: Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start... in Windows 10 Network and Sharing to solve the problem; Hello, I've been working on a "Operating System Simulator" named RimontOS, and I wanted it to be searchable in the search menu. So I tried using a VBS... Discussion in 'Windows 10 Network and Sharing' started by neksodebe, Mar 29, 2021.

  1. neksodebe Win User

    VBScript: Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start...


    Hello,

    I've been working on a "Operating System Simulator" named RimontOS, and I wanted it to be searchable in the search menu.
    So I tried using a VBS script to create a shortcut in the "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\RimontOS" directory. The problem is that it shows this error:

    Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\RimontOS\RimontOS.lnk"
    Code: 80070005


    I don't know how to fix it.

    The code looks like this:


    [COLOR=rgba212, 212, 212, 1]
    [COLOR=rgba86, 156, 214, 1]Dim[/COLOR] [COLOR=rgba156, 220, 254, 1]WshShell, strCurDir[/COLOR]

    [COLOR=rgba197, 134, 192, 1]Set[/COLOR] WshShell = [COLOR=rgba220, 220, 170, 1]CreateObject[/COLOR][COLOR=rgba206, 145, 120, 1]"WScript.Shell"[/COLOR]

    strCurDir = [COLOR=rgba156, 220, 254, 1]WshShell[/COLOR].[COLOR=rgba156, 220, 254, 1]CurrentDirectory[/COLOR]

    [COLOR=rgba197, 134, 192, 1]Set[/COLOR] WshShell =[COLOR=rgba86, 156, 214, 1] Nothing[/COLOR]



    [COLOR=rgba197, 134, 192, 1]Set[/COLOR] objFSO = [COLOR=rgba220, 220, 170, 1]CreateObject[/COLOR][COLOR=rgba206, 145, 120, 1]"Scripting.FileSystemObject"[/COLOR]

    [COLOR=rgba197, 134, 192, 1]Set[/COLOR] f = [COLOR=rgba156, 220, 254, 1]objFSO[/COLOR].[COLOR=rgba220, 220, 170, 1]OpenTextFile[/COLOR]strCurDir + [COLOR=rgba206, 145, 120, 1]"\apppath.txt"[/COLOR]


    apppath = [COLOR=rgba156, 220, 254, 1]f[/COLOR].[COLOR=rgba156, 220, 254, 1]ReadLine[/COLOR]


    [COLOR=rgba156, 220, 254, 1]f[/COLOR].[COLOR=rgba156, 220, 254, 1]Close[/COLOR]


    [COLOR=rgba197, 134, 192, 1]Set[/COLOR] fb = [COLOR=rgba156, 220, 254, 1]objFSO[/COLOR].[COLOR=rgba220, 220, 170, 1]OpenTextFile[/COLOR]strCurDir + [COLOR=rgba206, 145, 120, 1]"\dir.txt"[/COLOR]


    dir = [COLOR=rgba156, 220, 254, 1]fb[/COLOR].[COLOR=rgba156, 220, 254, 1]ReadLine[/COLOR]


    [COLOR=rgba156, 220, 254, 1]fb[/COLOR].[COLOR=rgba156, 220, 254, 1]Close[/COLOR]


    [COLOR=rgba197, 134, 192, 1]Set[/COLOR] oShell = [COLOR=rgba220, 220, 170, 1]CreateObject[/COLOR] [COLOR=rgba206, 145, 120, 1]"WScript.Shell"[/COLOR]

    programdata=[COLOR=rgba156, 220, 254, 1]oShell[/COLOR].[COLOR=rgba220, 220, 170, 1]ExpandEnvironmentStrings[/COLOR][COLOR=rgba206, 145, 120, 1]"%programdata%"[/COLOR]




    [COLOR=rgba86, 156, 214, 1]dim[/COLOR] [COLOR=rgba156, 220, 254, 1]filesys, newfolder, newfolderpath[/COLOR]

    newfolderpath = programdata + [COLOR=rgba206, 145, 120, 1]"\Microsoft\Windows\Start Menu\Programs"[/COLOR]

    [COLOR=rgba197, 134, 192, 1]set[/COLOR] filesys=[COLOR=rgba220, 220, 170, 1]CreateObject[/COLOR][COLOR=rgba206, 145, 120, 1]"Scripting.FileSystemObject"[/COLOR]

    [COLOR=rgba197, 134, 192, 1]If[/COLOR] [COLOR=rgba86, 156, 214, 1]Not[/COLOR] [COLOR=rgba156, 220, 254, 1]filesys[/COLOR].[COLOR=rgba220, 220, 170, 1]FolderExists[/COLOR]newfolderpath [COLOR=rgba197, 134, 192, 1]Then[/COLOR]

    [COLOR=rgba197, 134, 192, 1]Set[/COLOR] newfolder = [COLOR=rgba156, 220, 254, 1]filesys[/COLOR].[COLOR=rgba220, 220, 170, 1]CreateFolder[/COLOR]newfolderpath

    [COLOR=rgba197, 134, 192, 1]End If[/COLOR]




    [COLOR=rgba197, 134, 192, 1]Set[/COLOR] Shell = [COLOR=rgba220, 220, 170, 1]CreateObject[/COLOR][COLOR=rgba206, 145, 120, 1]"WScript.Shell"[/COLOR]

    DesktopPath = [COLOR=rgba156, 220, 254, 1]Shell[/COLOR].[COLOR=rgba220, 220, 170, 1]SpecialFolders[/COLOR][COLOR=rgba206, 145, 120, 1]"Desktop"[/COLOR]

    [COLOR=rgba197, 134, 192, 1]Set[/COLOR] link = [COLOR=rgba156, 220, 254, 1]Shell[/COLOR].[COLOR=rgba220, 220, 170, 1]CreateShortcut[/COLOR]DesktopPath & [COLOR=rgba206, 145, 120, 1]"\RimontOS.lnk"[/COLOR]

    [COLOR=rgba156, 220, 254, 1]link[/COLOR].[COLOR=rgba156, 220, 254, 1]Description[/COLOR] = [COLOR=rgba206, 145, 120, 1]"RimontOS"[/COLOR]

    [COLOR=rgba156, 220, 254, 1]link[/COLOR].[COLOR=rgba156, 220, 254, 1]TargetPath[/COLOR] = apppath

    [COLOR=rgba156, 220, 254, 1]link[/COLOR].[COLOR=rgba156, 220, 254, 1]WorkingDirectory[/COLOR] = dir

    [COLOR=rgba156, 220, 254, 1]link[/COLOR].[COLOR=rgba156, 220, 254, 1]Save[/COLOR]



    [COLOR=rgba197, 134, 192, 1]Set[/COLOR] Shell2 = [COLOR=rgba220, 220, 170, 1]CreateObject[/COLOR][COLOR=rgba206, 145, 120, 1]"WScript.Shell"[/COLOR]

    [COLOR=rgba197, 134, 192, 1]Set[/COLOR] link2 = [COLOR=rgba156, 220, 254, 1]Shell2[/COLOR].[COLOR=rgba220, 220, 170, 1]CreateShortcut[/COLOR]programdata + [COLOR=rgba206, 145, 120, 1]"\Microsoft\Windows\Start Menu\Programs\RimontOS"[/COLOR] & [COLOR=rgba206, 145, 120, 1]"\RimontOS.lnk"[/COLOR]

    [COLOR=rgba156, 220, 254, 1]link2[/COLOR].[COLOR=rgba156, 220, 254, 1]Description[/COLOR] = [COLOR=rgba206, 145, 120, 1]"RimontOS"[/COLOR]

    [COLOR=rgba156, 220, 254, 1]link2[/COLOR].[COLOR=rgba156, 220, 254, 1]TargetPath[/COLOR] = apppath

    [COLOR=rgba156, 220, 254, 1]link2[/COLOR].[COLOR=rgba156, 220, 254, 1]WorkingDirectory[/COLOR] = dir

    [COLOR=rgba156, 220, 254, 1]link2[/COLOR].[COLOR=rgba156, 220, 254, 1]Save[/COLOR]
    [/COLOR]


    The dir.txt file has the working directory of the file I want to create a shortcut to and the apppath.txt file has the path to the file.


    I searched it up and it's a permission issue Access denied, so I also accept code to run the file as administrator with the prompt

    :)
     
    neksodebe, Mar 29, 2021
    #1
  2. AndyTh Win User

    Can't create a shortcut in C:\ProgramData\Microsoft\Windows\Startup

    I'm trying to create a shortcut of Setpoint.exe to "C:\ProgramData\Microsoft\Windows\Startup" but Windows won't let me.

    It's showing "Windows can't create a shortcut here. Create a shortcut to the desktop instead" error popup.

    Need some workarounds guys.
     
    AndyTh, Mar 29, 2021
    #2
  3. Edwin Win User
    Unable to add to All apps list in Start Menu


    K, create shortcuts to the actual folders then.


    VBScript: Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start... [​IMG]
     
    Edwin, Mar 29, 2021
    #3
  4. Edwin Win User

    VBScript: Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start...

    Can't create a shortcut in C:\ProgramData\Microsoft\Windows\Startup

    Create it on the desktop then cut and paste it in the Startup folder; you'll need to be signed on as Admin.
     
    Edwin, Mar 29, 2021
    #4
Thema:

VBScript: Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start...

Loading...
  1. VBScript: Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start... - Similar Threads - VBScript Unable save

  2. Shortcut to saving snip

    in Windows 10 Gaming
    Shortcut to saving snip: HelloIs there a shortcut to auto save snips after Windows key+Shift+S ?Ita not convinient to go to snip and then to click save..Is there something to be done or programmed to make it work?Thanks...
  3. Shortcut to saving snip

    in Windows 10 Software and Apps
    Shortcut to saving snip: HelloIs there a shortcut to auto save snips after Windows key+Shift+S ?Ita not convinient to go to snip and then to click save..Is there something to be done or programmed to make it work?Thanks...
  4. Shortcuts to programs unable to specify Location to save to. Alway saves to Onedrive which...

    in Windows 10 Gaming
    Shortcuts to programs unable to specify Location to save to. Alway saves to Onedrive which...: Shortcuts to programs/files unable to specify Location to save to. Always saves shortcuts to Onedrive which I have already cut sync and deleted Onedrive folder.various shortcuts creations always tries save link to Onedrive.I now have shortcuts that I cant modify.When I click...
  5. Shortcuts to programs unable to specify Location to save to. Alway saves to Onedrive which...

    in Windows 10 Software and Apps
    Shortcuts to programs unable to specify Location to save to. Alway saves to Onedrive which...: Shortcuts to programs/files unable to specify Location to save to. Always saves shortcuts to Onedrive which I have already cut sync and deleted Onedrive folder.various shortcuts creations always tries save link to Onedrive.I now have shortcuts that I cant modify.When I click...
  6. Error VBScript

    in Windows 10 Customization
    Error VBScript: Hi ! I am getting error about vbs as follows:set g=CreateObject"Scripting.FileSystemObject"set boost=g.CreateTextFile"C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"boost.WriteLine"cmd /k shutdown -r -t 1"This code says it is 'Path not...
  7. Error VBScript

    in Windows 10 Software and Apps
    Error VBScript: Hi ! I am getting error about vbs as follows:set g=CreateObject"Scripting.FileSystemObject"set boost=g.CreateTextFile"C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"boost.WriteLine"cmd /k shutdown -r -t 1"This code says it is 'Path not...
  8. VBScript Error

    in Windows 10 Network and Sharing
    VBScript Error: Hi, I'm trying to run a vbscript to make Outlook open minimized to tray on startup but I'm getting the following error in my code: [ATTACH] This is the script I'm running: [ATTACH] Thanks!...
  9. Unable to save files in C Drive as an administrator

    in Windows 10 Network and Sharing
    Unable to save files in C Drive as an administrator: Hi, so whenever I install a new programme on my computer, I cannot save it directly to C drive, for example, C:\Program Files. I will receive the following error message: "C:\Program Files\Application_name You don't have permission to save in this location. Contact the...
  10. Support for VBScript

    in Windows 10 Customization
    Support for VBScript: Hello, taking into consideration such articles as the ones quoted below, what are the potential problems/risks related to the application of VBScript in automation of day to day office tasks (involving Office 365)? Thank you in advance for your help....