1

I am trying to change the "Start In" property of a program via batch file for an install script that I am writing for windows 10. I have not been able to find any info about where or how to do this. I've been dealing with the registry to other reasons, but I can't seem to find these fields in the registry. Here is photo of what I am trying to change for more clarity.

Here is a link to the image because my reputation is too low: https://cdn.discordapp.com/attachments/362700323099246593/523723895199629315/GetAttachmentThumbnail.png

4
  • All shortcut data is contained in the .lnk file. You cannot modify a .lnk file through a batch file. Commented Dec 16, 2018 at 6:40
  • If the .lnk is just a text file, it could be modified from a batch file or it could be recreated from scratch using many different scripting methods.or tools. This site's purpose however, is not to do this for you it's to help you fix your own. Please edit the question to include your code and explain how it has failed to work as written and intended. Commented Dec 16, 2018 at 9:41
  • @com: .lnk files use a binary file format. Commented Dec 16, 2018 at 11:19
  • @IInspectable, I specifically used If for a reason, were you to negate the If the comment would state, it could be recreated from scratch using many different scripting methods or tools. Regardless, until George, provides the code they're having issues with or at the very least, information about the shortcut location, and relevant shortcut's properties, this site is not the appropriate platform for their question. Commented Dec 16, 2018 at 11:57

2 Answers 2

0

I'm partial to solutions that work with native Windows components. PowerShell has access to the Windows shell object, which is where all the shortcut behavior is defined (or, at least, accessible).

In your case, you want to set the 'WorkingDirectory' field.

$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$Home\Desktop\MyShortcut.lnk")
$Shortcut.TargetPath = "path\to\parametric.bat"
$Shortcut.WorkingDirectory = "C:\Data\proengineer"
$Shortcut.Save()

More Info

Sign up to request clarification or add additional context in comments.

Comments

0

Download Shortcut.zip and extract it to a temporary directory. Read the file ReadMe.txt and copy the small executable Shortcut.exe written by Marty List into the directory of the batch file.

In the batch file use:

"%~dp0Shortcut.exe" /F:"C:\Path of\Shortcut.lnk" /A:E /W:"C:\Full path to new\Start in"

The small executable Shortcut.exe can be used of course also to create the *.lnk file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.