One of the most frustrating things when it comes to dealing with computers, are printers. These can be very expensive yet annoying to use and they can make it very hard to cancel a printing job.
One of the advantages of being a programmer is that you have a better understanding of how computers work, and can find your way around one easier. This turns you from a consumer who is stuck with the way things are, to a producer who can change things to his or her liking.
Below is a convenient way to cancel those stubborn printing jobs. This will stop the print spooler service, delete the spooled files, and then restart the print spooler service.
Simply run the following commands. You can also create a batch file to do this for you, by pasting these commands into a text file and saving it with the extension .cmd.
net stop spooler
del %systemroot%\system32\spool\printers\*.shd
del %systemroot%\system32\spool\printers\*.spl
net start spooler
Reference: http://support.microsoft.com/kb/946737
Documenting transition of life. From a student, to a worker. What had to be learned, and what had to be unlearned. An insight into one of the biggest changes.
Showing posts with label Batch file. Show all posts
Showing posts with label Batch file. Show all posts
Friday, November 9, 2012
Monday, July 9, 2012
Change directory to location of current batch file
Some people use batch files to run other programs or scripts found within the same folder. The problem with this is that people might execute these batch files from other applications. This leads to the current directory being set wrong, and thus not finding the application which is meant to be executed.
However, there exists a solution. To change the current location to that of the executing batch file, simply use the following line within the batch file:
cd %~dp0
More info can be found here.
However, there exists a solution. To change the current location to that of the executing batch file, simply use the following line within the batch file:
cd %~dp0
More info can be found here.
Thursday, May 3, 2012
Open process in new instance from batch file
Sometimes you need to open one or more executables or instances from a batch file. However, you would need to do this within a new process, as not to block the execution of the current batch file. The way to do this is by using the command Start.
Syntax
start ["title"] [/dPath] [/i] [/min] [/max] [{/separate | /shared}] [{/low | /normal | /high | /realtime | /abovenormal | belownormal}] [/wait] [/b] [FileName] [parameters]
Parameters
"title" : Specifies the title to display in Command Prompt window title bar.
/dPath : Specifies the startup directory.
/i : Passes the Cmd.exe startup environment to the new Command Prompt window.
/min : Starts a new minimized Command Prompt window.
/max : Starts a new maximized Command Prompt window.
/separate : Starts 16-bit programs in a separate memory space.
/shared : Starts 16-bit programs in a shared memory space.
/low : Starts an application in the idle priority class.
/normal : Starts an application in the normal priority class.
/high : Starts an application in the high priority class.
/realtime : Starts an application in the realtime priority class.
/abovenormal : Starts an application in the abovenormal priority class.
/belownormal : Starts an application in the belownormal priority class.
/wait : Starts an application and waits for it to end.
/b : Starts an application without opening a new Command Prompt window. CTRL+C handling is ignored unless the application enables CTRL+C processing. Use CTRL+BREAK to interrupt the application.
FileName : Specifies the command or program to start.
parameters : Specifies parameters to pass to the command or program.
Subscribe to:
Posts (Atom)