Jump to content

Recommended Posts

Posted

Hi all!

I have a little "problem", I would like to hide a batch file then at some moment in it, unhide it. i Explain:

I created a shortcut which starts minimized, ok.

at the end of the launched cmd file, I would like to start another one but àat this time unhided.

.cmd number one: (minimised)

[some code]

::I tried

call %systemdrive%\temp\restard.cmd

::oR

%systemdrive%\temp\restard.lnk (normal windowed link which launches restart.cmd)

but this doesn't work.

This is to remotely install some software, and then at the end of installation, ask the user to restart or not

.cmd number two (restart.cmd): (should be visible)

[some code]

:shutdown

set choice=

SET /P choice=Etes-vous sur(e) d'avoir sauvegard‚ tous vos documents ouverts? (o/n)

if not '%choice%'=='' set choice=%choice:~0,5%

if '%choice%'=='n' goto exit

if '%choice%'=='o' goto shutdown1

if '%choice%'=='N' goto exit

if '%choice%'=='O' goto shutdown1

ECHO "%choice%" n'est pas une entr‚e valide, r‚essayez SVP.

ECHO.

pause

GOTO shutdown

shutdown1

call "%SYSTEMROOT%\system32\shutdown.exe" -r 4

:exit

is this possible?

NB: If this can help, I'm working on W2k.


Posted

Try this

.cmd number one

rem your code here
start %systemdrive%\temp\restart.cmd
exit

.cmd number two (restart.cmd)

rem your code here
:shutdown
set choice=""
SET /P choice= (o/n)
if /i not "%choice%"=="o" goto exit

:shutdown1
start "%SYSTEMROOT%\system32\shutdown.exe" -r 4

:exit
exit

Posted

hi!

the "start %systemdrive%\temp\restart.cmd" was enough!

thx a lot!

I used the call function or just %systemdrive%\temp\restart.cmd, which didn't work.

I think I have plenty of things to learn about batch files ;-)

It works perfectly (will retry to be sure ;-) )

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...