Question: In Windows, how can I display the startup items from using a batch file?

Answer: 
Your startup items are a combination of your own items and the "All Users" items. You can find your own with:

```
dir "%homedrive%%homepath%\start menu\progams\startup"

```

and the "All Users" ones (usually) with:

```
dir "%homedrive%%homepath%\..\all users\start menu\progams\startup"

```

All you have to do is manipulate the file names to remove the path and the ".lnk" at the end to get the shortcut names.

If you `cd` to those directories first and just do dir, you won't even have to remove the path.

**UPDATE:**

If, as your comments seem to indicate, you want all things that start when your system starts, they're found all over the place. You'll want to get a copy of [Autoruns](http://technet.microsoft.com/en-us/sysinternals/bb963902.aspx) (or its command-line brother, Autorunsc, for your purposes).

This is the best approach since it's "blessed" by Microsoft themselves.
You can use [reg](http://www.ss64.com/nt/reg.html) command to query appropriate registry key:

```
reg QUERY HKCU\Software\Microsoft\Windows\CurrentVersion\Run > out

```

That will give you the list of keys in file "out", like this:

```
    UIWatcher    REG_SZ    D:\Utils\Ashampoo UnInstaller\UIWatcher.exe
    SpybotSD TeaTimer    REG_SZ    C:\Program Files\Spybot - Search & Destroy\TeaTimer.exe
    SandboxieControl    REG_SZ    "C:\Program Files\Sandboxie\SbieCtrl.exe"
    WMPNSCFG    REG_SZ    C:\Program Files\Windows Media Player\WMPNSCFG.exe

```

You need to parse this list to get first and second token where REG\_SZ is delimiter. If you want to stick to the plain batch language (meh...), which is nothing else but the trouble, you will have to use FOR /F command to get the tokens in manner:

```
FOR /F "tokens=1,2 delims=$" %i in (out) do @echo %i %j

```

Before that you will need to replace REG\_SZ with some char, lets say $, since FOR doesn't accept string delimiters. The entire process can be put in a single batch file:

```
SETLOCAL EnableDelayedExpansion

@echo off > StartUp.txt
FOR /F "skip=2 usebackq tokens=* delims= " %%i in (`reg QUERY HKCU\Software\Microsoft\Windows\CurrentVersion\Run`) do (  
    set LINE=%%i
    set LINE=!LINE:REG_SZ=$!
    FOR /F "tokens=1 delims=$" %%j in ('cmd.exe /C echo !LINE!') do echo %%j >> StartUp.txt
)

```

After you run it StartUp.txt should contain full names of programs, each on its own line. The construct 'cmd.exe /C echo !LINE!' is confusing. I put it as a workaround to the problem I had scanning LINE variable. According to the documentation it should just '!LINE!' but it doesn't work for some reason... In case you are interested in !VAR! syntax, see set /?

Anyway, batch language sucks big time, so its better to avoid it if possible, or to use it in conjuction with some serious tools like awk, sed, autohotkey etc... Each of them can parse the output of reg command in a single regexp line, while autohotkey can create even a nice GUI for it and u can totally avoid batch script.

At the end, dont forget to also can Run section for "All Users".