Remove Windows accounts or change PC administrator. Administrator:x: windows system32 cmd.exe Saat Mau. CMD WINDOW IN FEW. According to Microsoft, there are two methods to fix a C:/Windows/system32/cmd.exe error: boot the computer into safe mode, then troubleshoot to determine the cause of the issue, or perform a system restore. C:/Windows/system32/cmd.exe errors are frequently caused by misconfigured system files.
I am trying to invoke one executable by putting following line on command prompt. (I know I can directly invoke the exe but let's just say I have no other way to do this due to some restriction)
itself It is successfully run. /C
is parameter to cmd.exe
. But when I do this
Gives me error
Any idea why? And how can I solve this problem? I have to use full path of cmd.exe.
Ganesh SatputeGanesh Satpute5 Answers
Try this instead:
For example:
These work without any problem and both of them output 'Hello World'
SazidSazidAs stated by Stephan, the correct way of writing it is some of the following options
The question is Why 'cmd /c' .... works?
It works for the way the parser is interpreting the line.
When the line is readed and parsed, 'cmd /c'
is converted to
So it is executed as
This substitution can be easily tested
MC NDMC NDlooks for a file named C:WindowsSystem32cmd.exe /C
.
Have you ever seen a file with the extension .exe /c
?
Correct format is:
StephanStephanRegarding the additional question of why the extra quotes are needed: this is described in the help returned by cmd /?
, specifically
If /C or /K is specified, then the remainder of the command line after the switch is processed as a command line, where the following logic is used to process quote (') characters:
So, if the first (non-whitespace) character of the command is a quote, you need an extra pair of quotes around the entire command.
Additional note: combining MC ND's answer with mine, the first command line in the question is being interpreted like this: we start with
which becomes
due to the rule that replaces cmd
->%ComSpec%
combined with the bug/feature that discards the extra quote mark; this then becomes
because of the rule that removes the first and last quote marks when processing /C
.
The Win32 file system rules discard the extra backslash, so the executable launched is
and the executable is presumably ignoring the missing close-quote in its argument.
Harry JohnstonHarry JohnstonStrange it seems :/
This works. Don't know why. May be the double quotes before and after 'C:Program FilesABCxyz.exe' -register='abc'
are required. Wish if someone will explain that.
Not the answer you're looking for? Browse other questions tagged windowscommand-linecmd or ask your own question.
Because of Windows 10 security restrictions, I cannot run a software (WirelessModem.exe of D-Link) I used to run easily on Windows 8.1. However, I can run it from a CMD command prompt run under Administrator account. To make it convenient to open the software whenever I need it, I created a shortcut on my desktop, set it to run as administrator, set the target to 'C:WindowsSystem32cmd.exe' and *Start in' to the location where my said software is located, as shown in the following screenshots. Nevertheless when I run this shortcut, UAC prompts for Administrator confirmation and when I hit OK, CMD opens with system32 path, rather than the location I specified earlier in shortcut properties, why?
Please note that creating direct shortcut to wirelessmodem.exe does bring up a pop-up in red notice reading 'This app has been blocked for your protection' so the only hack I know is to run wirelessmodem.exe from an admin CMD window. So, my main concern in this question is to start cmd in the location of the said app, not in Windows' system32.
1 Answer
The Start In: location is where CMD.exe would open, not a file it would execute.
Why not just use a shortcut to D-Link Connection Manager, set to Run as Administrator? Create the shortcut, right-click on it to select Properties, and use Advanced properties settings to set Run as Administrator, as below: