Jump to content

Hi,

Currently, I have a bash script which when the user logs in the PC connects to a VM on another computer:

ECHO OFF
CLS
:MENU
ECHO.
ECHO ...............................................
ECHO PRESS 1 or 2 to select your OS, or 3 to EXIT.
ECHO ...............................................
ECHO.
ECHO 1 - Start Windows VM (port# 3390)
ECHO 2 - Start Ubuntu VM (port# 3389)
ECHO 3 - EXIT
ECHO.
SET /P M=Type 1, 2 or 3 then press ENTER:
IF %M%==1 GOTO Windows
IF %M%==2 GOTO Ubuntu
IF %M%==3 GOTO EOF
:Windows
mstsc /v:192.168.0.2:3390 /f
GOTO MENU
:Ubuntu
mstsc /v:192.168.0.2:3389 /f
GOTO MENU

Now what I want to add, is to be able for the PC to log off when the remote desktop program closes

 

Thank you

Link to comment
https://linustechtips.com/topic/994710-windows-7-bash-script/
Share on other sites

Link to post
Share on other sites

You need to use the "start /wait" command in front of the msctsc, and a log off command after that ... something like that ;

 

start /wait *application you need to run*
Shutdown -L

 

If you need help with your forum account, please use the Forum Support form !

Link to comment
https://linustechtips.com/topic/994710-windows-7-bash-script/#findComment-11963954
Share on other sites

Link to post
Share on other sites

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

×