![]() |
|
help with my batch program - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Coding (https://sinister.li/Forum-Coding--71) +--- Thread: help with my batch program (/Thread-help-with-my-batch-program) |
help with my batch program - commander - 01-24-2014 I am wondering how can I refer to the ¨C:\Documents and Settings\user\Start Menu\Programs\Startup¨ folder in my batch program as the folder ¨user¨ will be different in different machines. What we do in situations like this? RE: help with my batch program - ninja805 - 01-24-2014 (01-24-2014, 07:34 PM)commander Wrote: I am wondering how can I refer to the ¨C:\Documents and Settings\user\Start Menu\Programs\Startup¨ folder in my batch program as the folder ¨user¨ will be different in different machines. What we do in situations like this? I'm glad you asked! :Smile: Use "%userprofile%". F.E., Code: @echo off
start %userprofile%\george\untitled1.exeRE: help with my batch program - commander - 01-25-2014 (01-24-2014, 09:06 PM)ninja805 Wrote:(01-24-2014, 07:34 PM)commander Wrote: I am wondering how can I refer to the ¨C:\Documents and Settings\user\Start Menu\Programs\Startup¨ folder in my batch program as the folder ¨user¨ will be different in different machines. What we do in situations like this? Thank for the help... RE: help with my batch program - GeTaClue - 03-05-2014 %userprofile% points to the user's directory so the redundant '\george' will make it not work. To get to the user Startup folder use exactly what's in the quotes "%userprofile%\Start Menu\Programs\Startup" which you may actually have to quote it in your script because of the space. The system wide startup folder is "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup" which you can use as an alternative. RE: help with my batch program - Deque - 03-05-2014 (03-05-2014, 12:41 AM)GeTaClue Wrote: The system wide startup folder is "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup" which you can use as an alternative. C might not be the drive the system is installed on. Although it is the drive most people use, not everyone does. The Start Menu is in different locations for different Windows OS. The Startup folder can be found at: Windows XP/2003 Code: %ALLUSERSPROFILE%\Start Menu\Programs\StartupWindows 7/2008 Code: %ProgramData%\Microsoft\Windows\Start Menu\Programs\StartupOr user specific at: Windows XP/2003 Code: %USERPROFILE%\Start Menu\Programs\StartupWindows 7/2008 Code: %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\StartupA general solution to find the Start Menu folder might be a query in the registry: Code: REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Start Menu"RE: help with my batch program - ninja805 - 03-06-2014 (03-05-2014, 12:41 AM)GeTaClue Wrote: %userprofile% points to the user's directory so the redundant '\george' will make it not work. To get to the user Startup folder use exactly what's in the quotes "%userprofile%\Start Menu\Programs\Startup" which you may actually have to quote it in your script because of the space. The system wide startup folder is "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup" which you can use as an alternative. I did \george\ because that's where I keep my codes, haha. But there you go, that would work. RE: help with my batch program - GeTaClue - 03-06-2014 (03-06-2014, 02:52 AM)ninja805 Wrote:1. Not everyone else stores their codes in their %userprofile%\george.(03-05-2014, 12:41 AM)GeTaClue Wrote: %userprofile% points to the user's directory so the redundant '\george' will make it not work. To get to the user Startup folder use exactly what's in the quotes "%userprofile%\Start Menu\Programs\Startup" which you may actually have to quote it in your script because of the space. The system wide startup folder is "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup" which you can use as an alternative. 2. He specifically asked how to get to the Startup folder, not the place where his codes are stored. RE: help with my batch program - ninja805 - 03-06-2014 (03-06-2014, 03:09 AM)GeTaClue Wrote:(03-06-2014, 02:52 AM)ninja805 Wrote:1. Not everyone else stores their codes in their %userprofile%\george.(03-05-2014, 12:41 AM)GeTaClue Wrote: %userprofile% points to the user's directory so the redundant '\george' will make it not work. To get to the user Startup folder use exactly what's in the quotes "%userprofile%\Start Menu\Programs\Startup" which you may actually have to quote it in your script because of the space. The system wide startup folder is "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup" which you can use as an alternative. I was giving an example. I don't think many people have a 'george' folder. xD |