Closing command prompt windows.
Moderator: DosItHelp
Re: Closing command prompt windows.
I'm so sorry. I got pretty sick and bedridden. So I was out of work for a few days. : ( My apologies.
Anyway, yeah only the tracert gets changed to Observation. Saved a pic
Anyway, yeah only the tracert gets changed to Observation. Saved a pic
- Attachments
-
- yhrthsftghsftg.jpg (136.26 KiB) Viewed 8673 times
Re: Closing command prompt windows.
Seems to be the behavior on Win7 then. Since I only have access to Win10 machines I can't test it anymore. However, the only thing you have to do is to update the filter of TASKKILL (or FINDSTR in my former command line) according to your window title. You could have already done it weeks ago.
Steffen
Steffen
Re: Closing command prompt windows.
or I could just change the kill command to ping instead of observation and kill all the ping commands >.< I'm an idiot. Thank you, that command does work.
One quick question though before I stop bugging you lol.
Is there any way to move the "press any button" window like the others? if not that is fine, since I can just move the others out of the way.
One quick question though before I stop bugging you lol.
Is there any way to move the "press any button" window like the others? if not that is fine, since I can just move the others out of the way.
Re: Closing command prompt windows.
Something like that
But it doesn't work yet. I get a wrong syntax error for taskkill. Escaping is getting quite complicated.
Code: Select all
%start% "cmd /s /q /d /c ^"^"mode con cols=70 lines=25^&^(pause^>nul^|set /p ^"^"^=Press any key to close monitoring windows ...^"^"^)^&echo^(^&taskkill /f /t /fi ^"^"WINDOWTITLE eq Observation*^"^" /im cmd.exe^"^"" 0 342
Re: Closing command prompt windows.
If it helps, this is the working command before the resizes and position hits.
start "Close Observations" /min cmd /s /q /d /c "pause>nul|set /p "=Press any key on this window to close ping windows ..."&echo(&taskkill /f /t /fi "WINDOWTITLE eq ping*" /im cmd.exe"
start "Close Observations" /min cmd /s /q /d /c "pause>nul|set /p "=Press any key on this window to close ping windows ..."&echo(&taskkill /f /t /fi "WINDOWTITLE eq ping*" /im cmd.exe"
Re: Closing command prompt windows.
No. It's not a matter of the window title but of escape sequences that are required to pass and process the command line in the JScript section.
Re: Closing command prompt windows.
I found an error that flashes right away.
Did I screw it up?
%start% "cmd /s /q /d /c ^"^"mode con cols=70 lines=25^&^(pause^>nul^|set /p ^"^"^=Press any key on this window to close ping windows ...^"^"^)^&echo^(^&taskkill /f /t /fi ^"^"WINDOWTITLE eq ping*^"^" /im cmd.exe^"^"" 1158 684
Did I screw it up?
%start% "cmd /s /q /d /c ^"^"mode con cols=70 lines=25^&^(pause^>nul^|set /p ^"^"^=Press any key on this window to close ping windows ...^"^"^)^&echo^(^&taskkill /f /t /fi ^"^"WINDOWTITLE eq ping*^"^" /im cmd.exe^"^"" 1158 684
- Attachments
-
- afgdfgsdfgd.jpg (37.79 KiB) Viewed 8665 times
Re: Closing command prompt windows.
Hmm. I'm not familiar with escaping. In fact this is the first time I heard the term. ok so I looked at all the ^'s there are an odd number, but that seems to work on all the other lines. There is an even number of "" so I don't think that is the case. I looked at the working line and tried to compare it to this not working line. All the * and &'s seem spot on. Taking out the eq that gives the error message makes ping the error message, so he has to be something before that. All the switches seem the same, unless I need a /k? Adding that just yells at me. It is weird seeing a ( without a ), but the working code has that too. Is it because it is missing the "Close Observations" /min. Because adding that causes it to not even show up.
Any more hints?
I also noticed that it still calls tracert "observation" despite that part taken out...
The working code seems to not use set, but the not working code makes use of set. I'm not sure how that works. I took a screenshot of the working one, and it seems to turn all the pings into observations.
Any more hints?
I also noticed that it still calls tracert "observation" despite that part taken out...
The working code seems to not use set, but the not working code makes use of set. I'm not sure how that works. I took a screenshot of the working one, and it seems to turn all the pings into observations.
Re: Closing command prompt windows.
Ok I've been pouring over this script for the last 2 hours inbetween calls. I'd added and subtracted here and there. I've studied it closely with the one that works. I don't think I know enough to know what the issue is. I feel like I'm missing something very simple. In that time I did learn how to did the script part, and have the line to call the script. That was neat.
This just keeps failing and saying eq is not a valid argument.
@if (@a)==(@b) @end /*
@echo off &setlocal
set "start=cscript //nologo //e:jscript %~fs0 "
set /p number="4 digit store number? "?
%start% "cmd /s /q /d /c ^"^"mode con cols=70 lines=25 ^&^(pause^>nul^|set /p ^"^"^=Press any key on this window to close ping windows ...^"^"^)^&echo^(^&taskkill /f /t /fi ^"^"WINDOWTITLE eq ping*^"^" /im cmd.exe^"^"" 1158 684
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& ping str%number% -t ^"^"" 0 0
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& ping str%number%vma -t ^"^"" 0 342
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& ping str%number%vmb -t ^"^"" 0 684
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& tracert str%number% ^"^"" 579 0
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& ping str%number%sa -t ^"^"" 579 342
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& ping str%number%sd -t ^"^"" 579 684
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& ping sw%number%a -t ^"^"" 1158 0
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& ping sw%number%b -t ^"^"" 1158 342
goto :eof */
var objWMIService = GetObject('winmgmts:\\\\.\\root\\CIMV2'),
objProcess = objWMIService.Get('Win32_Process'),
objParam = objProcess.Methods_('Create').InParameters.SpawnInstance_(),
objStartup = objWMIService.Get('Win32_ProcessStartup').SpawnInstance_();
objStartup.X = WScript.Arguments(1);
objStartup.Y = WScript.Arguments(2);
objStartup.Title = 'Observation';
objParam.Properties_.Item('CommandLine').Value = WScript.Arguments(0);
objParam.Properties_.Item('ProcessStartupInformation').Value = objStartup;
objWMIService.ExecMethod('Win32_Process', 'Create', objParam);
This just keeps failing and saying eq is not a valid argument.
@if (@a)==(@b) @end /*
@echo off &setlocal
set "start=cscript //nologo //e:jscript %~fs0 "
set /p number="4 digit store number? "?
%start% "cmd /s /q /d /c ^"^"mode con cols=70 lines=25 ^&^(pause^>nul^|set /p ^"^"^=Press any key on this window to close ping windows ...^"^"^)^&echo^(^&taskkill /f /t /fi ^"^"WINDOWTITLE eq ping*^"^" /im cmd.exe^"^"" 1158 684
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& ping str%number% -t ^"^"" 0 0
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& ping str%number%vma -t ^"^"" 0 342
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& ping str%number%vmb -t ^"^"" 0 684
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& tracert str%number% ^"^"" 579 0
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& ping str%number%sa -t ^"^"" 579 342
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& ping str%number%sd -t ^"^"" 579 684
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& ping sw%number%a -t ^"^"" 1158 0
%start% "cmd /s /q /d /k ^"^"mode con cols=70 lines=25 ^& ping sw%number%b -t ^"^"" 1158 342
goto :eof */
var objWMIService = GetObject('winmgmts:\\\\.\\root\\CIMV2'),
objProcess = objWMIService.Get('Win32_Process'),
objParam = objProcess.Methods_('Create').InParameters.SpawnInstance_(),
objStartup = objWMIService.Get('Win32_ProcessStartup').SpawnInstance_();
objStartup.X = WScript.Arguments(1);
objStartup.Y = WScript.Arguments(2);
objStartup.Title = 'Observation';
objParam.Properties_.Item('CommandLine').Value = WScript.Arguments(0);
objParam.Properties_.Item('ProcessStartupInformation').Value = objStartup;
objWMIService.ExecMethod('Win32_Process', 'Create', objParam);
Re: Closing command prompt windows.
I also tried a lot but still don't know how to get it working.
Re: Closing command prompt windows.
Oooh. and here I thought you were testing me lol
The working one is this
start "Close Observations" /min cmd /s /q /d /c "pause>nul|set /p "=Press any key on this window to close ping windows ..."&echo(&taskkill /f /t /fi "WINDOWTITLE eq ping*" /im cmd.exe"
The one I wanted to work is
%start% "cmd /s /q /d /c ^"^"mode con cols=70 lines=25 ^&^(pause^>nul^|set /p ^"^"^=Press any key on this window to close ping windows ...^"^"^)^&echo^(^&taskkill /f /t /fi ^"^"WINDOWTITLE eq ping*^"^" /im cmd.exe^"^"" 1158 684
For some reason, the one that works changes all the ping windows to "Observations" right as it closes it. But the one that doesn't work, well doesn't. I guess I'll just move the windows over.
Still thank you very much for everything you have done AGerman. I am grateful.
The working one is this
start "Close Observations" /min cmd /s /q /d /c "pause>nul|set /p "=Press any key on this window to close ping windows ..."&echo(&taskkill /f /t /fi "WINDOWTITLE eq ping*" /im cmd.exe"
The one I wanted to work is
%start% "cmd /s /q /d /c ^"^"mode con cols=70 lines=25 ^&^(pause^>nul^|set /p ^"^"^=Press any key on this window to close ping windows ...^"^"^)^&echo^(^&taskkill /f /t /fi ^"^"WINDOWTITLE eq ping*^"^" /im cmd.exe^"^"" 1158 684
For some reason, the one that works changes all the ping windows to "Observations" right as it closes it. But the one that doesn't work, well doesn't. I guess I'll just move the windows over.
Still thank you very much for everything you have done AGerman. I am grateful.