Keep printer settings when printing from command line - windows

I am trying to print graphics from the command line. I am using the command rundll32 C:\Windows\System32\shimgvw.dll,ImageView_PrintTo , which works fine - BUT:
I have special settings for the desired printer. Those settings are set in the current settings and are used by default from all other programs. Only the above mentioned dll ignores my settings and kind of resets the printer (uses the factory settings).
Is there any way to prevent this?
Of course I could use another programm to print - but my solution has to run on as much (windows) pc's as possible, therefore I have to rely on build-in functions of windows.
Thanks for advice!

Related

Set up file and registry redirection for a given (new) process in Windows

I want to set up path redirection in both files and registry keys in the same manner UAC virtualization works for another process at launch time (either programmatically or using some existing interface).
For example, I want to run C:\my_path\app.exe and when it opens any file on disk (C:\other_path\file.txt) for writing, the actual open file should be C:\temp_for_my_app\C\other_path\file.txt.
I've seen some programs are able to set up such redirection (i.e. Sandboxie), but I'm unsure which mechanism they are using (not even sure if it is the same UAC virtualization uses).
Any insight into the way UAC virtualization implements it might be useful (your comment on this will be appreciated)
Try cmregistercallback() or API HOOKING to hook zwopenkey() and zwcreatekey()

How to change the system locale on Windows 7

On windows 7, I would like to change the system locale from the command line without restarting. Is there any windows command line utility or the one in cygwin that I can use?
Thanks
The following link has information of how to change system locale kind of information from the command-line using the intlcfg.exe command.
An example command for you could be as follows, which would change syslocale to US-english en-US.
intlcfg.exe –syslocale:en-US
NOTE: You may still need to reboot for the settings to take effect, have not tried this so unsure about this part.
Doing a quick Google search turned up a lot of results with different ways to do it.
This TechNet article details how to use the Intlcfg command to change settings such as the Locale
Update language and locale settings
intlcfg.exe [-all:language_name] [-uilang:language_name] [uilangfallback:language_name] [-syslocale:language_name][-userlocale:language_name] [-inputlocale:default_keyboard_description; keyboard_description or locale_name] [-userhive:registry_path] [-syshive:registry_path] [-swhive:registry_path] [-image:path] [-dist:path] [-silent] [-skudefaults:language]
This article on AutoIt.com talks about setting up XML files and creating a script to switch between them.
It's hard to quote, but the gist is:
Create a text file with the settings
Use rundll32 to apply the changes to the registry

Run a bootable USB of command prompt compatible with multiboot

I need to know if a program exists ( or if I can create) that runs that computer's command prompt from a USB, without having to log in. I guess I don't really care if it is that computers cmd, but I need all of the modern functions of today's cmd. I also need to make sure that it has full administrative privileges. I know that it is possible, because just about every Linux system uses a similar system when it initially boots up, even when just downloaded to USB.
I guess I really need something that I can use with multiboot (a pure ISO file, not something like Rufus, which requires you to format usb). I don't know, but I don't think an ms dos thingy would have all of today's commands in cmd.
Any help much appreciated. Piece.
Edit: I just need the equvolent of single user mode in a Mac. Administrative access to the terminal without login info.
You can boot windows to safe mode limited command prompt, or you can launch a cmd window via the startup group (but you can't get a full screen after XP and the window can be closed with the latter method).
That is the first issue for you to solve, and then you can consider booting from USB.

Make system calls (Windows Command Prompt) answer in english

I'm working on a Perl script that needs to do a few system calls to obtain some system data. In order to parse the output of those calls reliably on any computer, I need to be sure the output of the call is set to English.
The problem I'm facing is that, for example in my PC, I get localized output from those commands. My Windows is setup in Spanish so, calls like systeminfo return data in Spanish.
Is there a command (or something else) I can run in a command call to make all system calls act like if the system was in English always, without having to modify anything in the system configuration?
Thanks in advance for your comments.
NOTES for bounty: The answer to this problem must not interfere with the system in any way. It should be a way to obtain english answers from system calls/commands that works in any machine without modifying its configuration, registry or else.
This solution allows you to make Command Prompt act in english. It does alter some registry keys but it also changes them back if you want. You can run the same commands that they put in the .bats to make the system go to english and them go back to localized.
If you're trying to run commands that require adminsitrator privileges, then you can include these calls in your program without problems.
HTH
I think the WMIC command is your best best. It has been a standard feature of Windows since Windows XP.
WMIC has full access to the Windows system (subject to user permissions, etc.), and has a locale option that selects the locale in effect (for the command) from the installed language packs.
The locale is selected from the list here.
To get the current username using US English (if it's available) you'd use wmic /locale:ms_409 netlogin get name
Through the WMI interface, you may not even need to localise the results (i.e.: with sufficient care, you may just get the raw data).

bat file to launch exe and wait for string in standard output

Folks,
Is it possible to create a bat file that launches an executable and waits for a pre-determined string in the standard output. When that string is found, the batch file will exit (the exe can continue running). How could this be accomplished?
In short, no.
Note that originally MS-DOS was an operating system in which Windows ran. Now it is an application that simulates the earlier OS. The way to solve your would possibly involve using an application called from within MS-DOS, that will perform this kind of logic (i.e. IF(file_is_present_with_string)THEN {...}) in the MS-DOS command library.
Powershell is a powerful scripting language allowing you to perform many operations previously unavailable in MS-DOS, such as take the output from one MS-DOS command (e.g. ipconfig /all) and reformat it into a different layout, possibly using it as another command's input parameters (e.g. select a value from ipconfig and use it in another command). Although it supports MS-DOS command execution, it does so through the use of CMDLETs (pronouned command-let) which is a self-contained application designed to run inside Powershell. There are many other CMDLETs out there that might be able to help solve your problem.

Resources