Anyone if you know a cmd good enough to teach about it or give decent description/examples then post it here and I'll link it to first page as part of the "repo"
hi guys How can hide Command window when batch file runs this is my xp.bat file thank you "C:\wxxx\xp.bat"
Here are cmds to post demonstrations for the batch repo 1st post if anyone's interested Creating Menu -- CHOICE, GOTO Using arguments -- SHIFT Subroutines -- CALL Remarks -- REM Hide Stuff -- NUL Find String -- FINDSTR Here is simple cmd nul that hides cmds as they are run in cmd prompt Code: @echo off echo.Please wait while status is being done >nul slmgr /dlv pause This way you can make your batch so it doesn't show cmds just what you want it to say. The NUL cmd should have it's own complete post as to it's total usage so any one interested who knows that cmd do it
NUL is the name of a special "file" that discards all information that is attempted written to it, while reporting "write succeeded" to the caller. It's often referred to as a "Black Hole". Look at it as a bottomless trash can. In other words, it behaves the same way as a normal file on your hard drive and is often used for disposing of an unwanted data Stream. The equivalent in Linux operating systems is the /dev/null file. Consider the following example: Code: echo "Good bye cruel world" >> NUL The text "Good bye cruel world" will be echo'ed into the NUL file and will effectively be gone forever. That could make a nice comic lol, "You want me to write this data? You do? All right, watch me write your data with this LIGHTER" In this following example, NUL has been substituted with example.txt Code: echo "What a wonderful world" >> example.txt In this scenario, the text will be written to the example.txt file and will be available for reading by other applications later.
I am using the Windows Scheduler to run a batch file at a specific time. When it is running, the command prompt will prompt out for about a quarter of a second to show it is running. I want to hide the command prompt window so that it runs without me even knowing it. I have tried putting @ECHO OFF as the first line in the batch file, but this still opened the command prompt window executing the command. Is this even possible?
This task should run silent Code: schtasks /create /tn "YourTaskName" /tr "%SystemDrive%\Wherever\Your.bat" /sc daily /mo 1 /ru "" Just change the number 1 to whatever days you need task to run If you need hours or minutes look in links in first post to find how to put those things at end of the batch
Yes, it's possible to hide the command prompt window in a scheduled task. All you need to do is have it run under a different account than you are logged in as — such as the Local System (S-1-5-18), using /RU SYSTEM.
Here are both IR4 and IORRT tasks that both run hidden/silent Code: schtasks /create /tn "Rearm" /tr "'C:\Windows\system32\cmd.exe' /c cscript.exe /b C:\Windows\System32\slmgr.vbs /rearm && net stop sppsvc && net start sppsvc" /sc daily /mo 30 /ru "" /f Code: schtasks /create /tn "IORRT" /tr "%SystemDrive%\IORRT\IORRT.bat" /sc daily /mo 1 /ru ""
How do I create a batch file to delete all *.exe except for 1 exe file ? presently I am renaming the exe file to something else before deleting the exe files; eg ren c:\example\donotdelete.exe donotdelete.zip del /q c:\example\*.exe ren c:\example\donotdelete.zip donotdelete.exe
@sulasno This for-loop should do the job Code: @echo off for %%i in (C:\Example\*.exe) do if not "%%i"=="donotdelete.exe" del /q "%%i" pause Edit: This example is wrong, check this post (#96 in this thread) for the solution.
@Calistoga this is the actual batch Code: @echo off for %%i in "C:\Documents and Settings\username\APLN\iopus\*.exe" do if not "%%i"=="Downloader.exe" del /q "%%i" pause no files are being deleted; I tried changing %%i to %%x but still no exe files are being deleted
Oops sorry there bud, I did a mistake in the code. Does this work properly? Code: @echo off cd /d "C:\Documents and Settings\username\APLN\iopus\" for %%i in (*.exe) do if not "%%i"=="Downloader.exe" del /q "%%i" pause
No solution yet? Here is diamond.bat: Code: @echo off if not "%1"=="5" goto nojoy if "%1"=="5" goto diamond :nojoy echo. echo No diamond found! Try again... goto end :diamond echo. echo 0 echo 0 1 echo 0 1 2 echo 0 1 2 3 echo 0 1 2 3 4 echo 0 1 2 3 4 5 echo 0 1 2 3 4 5 echo 0 1 2 3 4 echo 0 1 2 3 echo 0 1 2 echo 0 1 echo 0 goto end :end Cheers
Well, well... The code above is extremely easy and scarcely needs an explanation. "%1" corresponds to the first argument; "%2" would correspond to the second argument and so on. You can use anything as an argument, including "professional-alike" arguments like "/A", "-R" and so on. Note that using letters instead of numbers will force you to take account of uppercase and lowercase letters. If you don't want the user to be bothered with uppercase/lowercase alternatives, or with minor questions like using "/" or "-" in an argument, you may turn things easier to him this way: Code: if "%1"=="/R" goto diamond if "%1"=="/r" goto diamond if "%1"=="-R" goto diamond if "%1"=="-r" goto diamond Now let's propose a small variation of the challenge above. Rewrote the code of "diamond.bat" in order to obtain this output: Code: Here is your diamond: 0 0 1 0 1 2 0 1 2 3 0 1 2 3 4 0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 0 1 2 3 0 1 2 0 1 0 But in such way that it will replace the word "diamond" with any name you may choose to rename the batch file itself.