How to take folder path in a variable opened by shell:startup in windows

2

Hi i am trying to create a script that can add other scripts in startup.

'shell:startup' opens place to put the shortcut for startup programs, if i can somehow take its output in a variable, then i don't have to worry about taking different startup folder path for different versions of windows

Mukul Sharma

Posted 2018-03-01T18:27:54.023

Reputation: 121

1this is actually a good idea. what language , dos or powerhsell? – MichaelEvanchik – 2018-03-01T19:14:22.833

@MichaelEvanchik For now windows, but we need to support all major platforms-linux,windows,mac. A .bat script will be very good, i think i can translate it to python code – Mukul Sharma – 2018-03-02T06:07:23.480

Answers

1

The current user's start-up folder (where shell:startup leads you) can be located with variables as such:

Batch:

"%appdata%\Microsoft\Windows\Start Menu\Programs\Startup"

Example of putting the whole thing into a variable and using it:

set userStartup="%appdata%\Microsoft\Windows\Start Menu\Programs\Startup"
echo %userStartup%

PowerShell:

"$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup"

Example:

$userStartup = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup"
write-output $userStartup

Ƭᴇcʜιᴇ007

Posted 2018-03-01T18:27:54.023

Reputation: 103 763