Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

batch copy to startup folder


ghost's Avatar
0 0

hi im trying to make a batch installer that automatically makes a shortcut of another bat file and puts it in the markup%windir%\Start Menu\Programs\StartUp directory. I have absolutely no clue where to start… can someone help?


ghost's Avatar
0 0

Could you give some more info as there may be some other useful ways here.


ghost's Avatar
0 0

s0l1dsnak3123 wrote: hi im trying to make a batch installer that automatically makes a shortcut of another bat file and puts it in the markup%windir%\Start Menu\Programs\StartUp directory. I have absolutely no clue where to start… can someone help?

um…couldn't you just make the batch file that would call the other .bat?

Like, save the file to wherever and in that bat do:

markupcall location/theother.bat

?


ghost's Avatar
0 0

the batch should be in the same dir as the installer batch. all i want it to do is make a shortcut file and copy it to the startup folder… is that any easier to understand? (p.s not meant as an insult)

nights_shadow wrote: [quote]s0l1dsnak3123 wrote: hi im trying to make a batch installer that automatically makes a shortcut of another bat file and puts it in the markup%windir%\Start Menu\Programs\StartUp directory. I have absolutely no clue where to start… can someone help?

um…couldn't you just make the batch file that would call the other .bat?

Like, save the file to wherever and in that bat do:

markupcall location/theother.bat

?[/quote]

edit sorry i dont quite understand…


ghost's Avatar
0 0

Yeah, don't worry, i got what you were trying to say. Here's what i was thinking though:

3 batch files 1 = thething 2 = theshortcut 3 = theinstaller?

theshortcut:

call thething.bat```

theinstaller:
```markup@echo off
copy thething.bat idontknowwhere/thething.bat
echo Would you like to create a shortcut? (Y/N)
set /p short=
echo.
if "%short%" == "Y" GOTO yes
echo Shortcut not created
pause
exit
:yes
echo Creating the shortcut...
copy theshortcut.bat %windir%\Start ~1\Programs\StartUp
echo.
echo Done, would you like to run the program? (Y/N)
set /p run=
echo.
if "%run%" == "Y" GOTO run
echo Goodbye
pause
exit
:run
cls
call thething.bat```


Something like that?

ghost's Avatar
0 0

markupcopy theshortcut.bat %windir%\Start ~1\Programs\StartUp when I adapt this for my batch ( markupcopy abcsql.bat %windir%\Start ~1\Programs\StartUp\abcsql.bat) I get a "syntax of the command is incorrect error… what exactly am I doing wrong? :/

[edit] here is my code, minus the unimportant stuff :)

cls
PAUSE
copy abcsql.bat %windir%\Start ~1\Programs\StartUp\abcsql.bat
PAUSE
:loop
goto loop```

the shortcut is an actual .lnk file you find on your desktop...

[double edit]

p.s the batch is nothing to do with sql :)

Uber0n's Avatar
Member
0 0

\Start ~1\

This is invalid. You mustn't have a space there.

Use

%windir%\Start~1\Programs\StartUp\abcsql.bat

instead ;)


ghost's Avatar
0 0

This worked for me, except i did:

copy abcsql.bat %systemroot%\All Users\Start Menu\abcsql.bat

<edit>basically what Uber0n said</edit>


ghost's Avatar
0 0

This worked for me, except i did:

copy abcsql.bat %systemroot%\All Users\Start Menu\abcsql.bat

<edit>basically what Uber0n said</edit> That didn't work at all :/

Uber0n wrote: \Start ~1\

This is invalid. You mustn't have a space there.

Use

%windir%\Start~1\Programs\StartUp\abcsql.bat

instead ;) this partially worked, I got a "The system cannot find the path specified.0 file(s) copied." error…


ghost's Avatar
0 0

i guess this:

copy something.bat "%userprofile%\start menu\programs\startup\"gotcha.bat

might work…if not,try to loose the quotes…


ghost's Avatar
0 0

i guess this:

copy something.bat "%userprofile%\start menu\programs\startup\"gotcha.bat

might work…if not,try to loose the quotes…

lovely thanks :happy: