Batch file not closing with exit command
I am opening a .net solution in visual studio 2019 using batch command through a batch file like this
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv.exe" "D:\Pawan\Projects\MyProj\src\MyProj.sln"
and it is working, it opens the project in VS2019 successfully.
The problem is it keeps the command window open and not closing by any of these commands I tried
exit /b 0
See also questions close to this topic
How to create a batch file for the particular command in cmd
@echo off cd ../../"Program Files (x86)"/Nox/bin nox_adb.exe kill-server nox_adb.exe connect 127.0.0.1:62001 PAUSE
How do i create a batch file to run this command in cmd, this here does not work. Thank You!
how to read the elements of an array
I have created a variable of type array but both the variable name and indexes are variables, And I would like to read them as a loop FOR: This is the code snippet that I can't solve
set /p dato=dato: set /a indice+=1 for %%a in (%dato%) do (set %campo[%indice%]%=%%a) for %%b in (%campo[%?%]%) do echo %%b
I can't understand How to tell the command to search all elements of that array.
compressing multiple files into bzip2
so i found this nice batch for window that would compress every file of the same extension in the same directory into bzip2 by dragging and dropping any of the files into it but i would like to take it further and make it that when i drag and drop a folder into it. it would compress all the files in it, including the sub-folders until it reaches the end. obviously i would guess it has something to do with looping with using %%d but i could not exactly figure it out.
@echo off if [%1]== goto usage for /f %%i in ("%1") do ( echo %%~di echo %%~pi echo %%~xi set rootpath="%%~di%%~pi*%%~xi" ) for %%f in (%rootpath%) do ( "C:\Program Files\7-Zip\7z.exe" a -tbzip2 "%%f.bz2" "%%f" -mx9 del "%%f" /s /f /q ) echo Finished operations! goto exit :usage echo You have to drag and drop a file on this batch script! echo Sorry for the poor documentation, but if you'll want to use it, you have to edit the .bat file echo The only thing you really need is to change the path to your 7-Zip installation echo Then simply drag and drop a file in a folder you want to BZip2, and it'll do the rest automatically :exit pause
How long does a nmap syn scan with the timing template set to -T1 take and is there a way to improve it's speed?
I'm entirely new / excited to learn about computers, linux and most recently port scanning . After reading about nmap in a book, I began to read the manual & website of nmap, and play around with it out by scanning my own devices (which i figured was the best approach).
I was getting not great results scanning the ports of my devices with nmap set to the standard timing, so I set the timing to -T1 (sneaky) to see if I would get different results. The command I used was:
sudo nmap -sS -T1 <ip.address>
Now, the nmap website describes this type of scan as "extraordinarily long" and doesn't really give a concrete number of how long it usually takes. Is there anyway for me to speed up a scan of this nature? Is the time my port scan takes just connected to bandwidth or is it also the type of computer I'm scanning?
(Also does a port scan set to -T1 always give me more accurate results, and therefore should be used more often? Sorry for all the questions.)
How do I shut down a win10 box exactly like it shuts down using start menu “button,” but via task scheduler?
Preface: This box locks up when it goes to sleep (requires 5sec hard kill to power off and reboot), so the intent is to disable sleep, yet shutdown via task scheduler after set idle time.
Details: This MSwin10 box shuts down fully when using the start menu, however, command line\ "shutdown /s" and powershell\ "stop-computer" commands both result in a half state where fans and lights continue to run.
I have sleep, hibernate, & fast start disabled as evidenced by cmd\powerfg /A and group policy output. The scheduled task works, in that it runs the requested commands, but it is running commands that only yield a half off state.
argparse: nargs with multiple flags in one dash?
If I try running
python test.py -bfwith the below code, I get
foo=foo1instead of the desired result (
foo=foo1). How would I achieve the desired result?
import argparse ap = argparse.ArgumentParser(description='test') ap.add_argument('--bar', '-b', nargs='?', const='bar1') ap.add_argument('--foo', '-f', nargs='?', const='foo1') args = ap.parse_args()
Exit macro for closing Chrome or other browser in powerpoint
i made this:
ActivePresentation.FollowHyperlink _ Address:="http://192.168.16.49/?OUT1=ON", _ NewWindow:=False, AddHistory:=False ActivePresentation.SlideShowWindow.View.GotoSlide (2) End Sub
Now it opens Chrome to show the page. but i wan't to close that page also directly. wat do i have to do?
PHP exit only current included script file from inside a function
I know I can use
returnto exit current script file, but what if we want to exit current script from inside a function?
For example, we define a
exitScript()function that prints closing html tags and exits current script file, but if we use
returnit only exits from current function.
exit(), conditonals, return or break on Python menu?
If we are doing a menu on python and the user selects option for finish the interaction. Is preferable to use exit(), conditionals, return or break?
Example with break, where we stop the infinite loop with the break:
def show_menu(): print('1. Pet kitten\n' '0. Exit') def start_app(): while True: show_menu() user_choice = input('Select an option: ') if user_choice == '1': pet() elif user_choice == '0': print('\nBye!') break else: print('\nPlease select a number from the menu.') start_app()
Example with exit(), where we use built-in function exit() for stop the execution of the script:
def show_menu(): print('1. Pet kitten\n' '0. Exit') def start_app(): while True: show_menu() user_choice = input('Select an option: ') if user_choice == '1': pet() elif user_choice == '0': print('\nBye!') exit() else: print('\nPlease select a number from the menu.') start_app()
Example with conditionals, where the while stops when the condition change:
def show_menu(): print('1. Pet kitten\n' '0. Exit') def start_app(): continue_ = True while continue_: show_menu() user_choice = input('Select an option: ') if user_choice == '1': pet() elif user_choice == '0': print('\nBye!') continue_ = False else: print('\nPlease select a number from the menu.') start_app()
Example with return, where we finish the interaction returning a random value:
def show_menu(): print('1. Pet kitten\n' '0. Exit') def start_app(): continue_ = True while continue_: show_menu() user_choice = input('Select an option: ') if user_choice == '1': pet() elif user_choice == '0': print('\nBye!') return None else: print('\nPlease select a number from the menu.') start_app()