Signtool always says a parameter is missing - windows

I recently made a game in Unity3D and I am trying to sign the code with a certificate I bought from Comodo (saved in a pfx file). I have done a ton of research on how to use it and have settled to running these commands:
doskey signtool="C:\Program Files (x86)\Windows Kits\10\Tools\bin\i386\signtool.exe"
signtool sign /f "C:\...[path to cert on desktop]...\cert.pfx" "C:\...[path to exe on desktop]...\Game.exe"
No matter what I do, or slight variations I try, or anything, I always get the same error:
SignTool Error: A required paramter is missing.
Usage: signtool <command> [options]
Even running "signtool sign /?" gives me this same error. I don't understand why the program won't do or even tell me anything useful. Some sources I've seen say I need to add a "/p passwordHere" after the /f option, but that gives the same error message as all others.

You must let doskey know that the macro signtool expects parameters, which are to be passed onto the real signtool.exe. This is done by appending $* at the end of the definition.
doskey signtool="C:\Program Files (x86)\Windows Kits\10\Tools\bin\i386\signtool.exe" $*
From the official Doskey docs (highlight mine):
To run a macro, type the macro name at the command prompt, starting at the first position. If the macro was defined with $* or any of the batch parameters $1 through $9, use a space to separate the parameters.

Related

Setting Inno Setup sign tool with relative paths

I'm trying to set the Inno Setup IDE "Sign Tools" command to use a relative path.
I made a sign.bat script which calls signtool.exe following the file structure below:
code_sign\
+ sign.bat
+ signtool.exe
+ cert.pfx
script.iss
If I set the Sign Tool (Tools / Configure Sign Tools...) command to code_sign\sign.bat $p, I got the following error message:
Sign Tool command failed (Failed to execute Sign Tool.
Error 2: The system cannot find the file specified). Will retry (2 tries left).
Running Sign Tool command: sign.bat "(...)\uninst.e32.tmp"
Sign Tool command failed (Failed to execute Sign Tool.
(...)
What is the working path when the sign tool is called?
Sadly I cannot use an absolute path (which works) as the code_sign folder is meant to be a submodule shared with other applications and other users.
What I'm doing wrong here? Should I use the command line version?
Edit: as requested, the sign.bat contents:
SET script_path=%~dp0
SET stool=%script_path%signtool.exe
SET pfx=%script_path%cert.pfx
SET ntp=http://timestamp.globalsign.com/scripts/timstamp.dll
SET pwd=12345
"%stool%" sign /f %pfx% /p %pwd% /tr %ntp% /td SHA256 %1
Configure your sign tool command as only $p.
And then in your .iss, set the SignTool directive as follows (assuming the sign tool command is named custom), with a use of SourcePath preprocessor predefined variable.
[Setup]
SignTool=custom {#SourcePath}\code_sign\sign.bat $f

Start external program with arguments (in Visual Studio - Debug properties)

Is it possible to run program with parameters, like on screenshot (Specifically, I've tried to run CMD with some params):
It gives me an error while I am trying to do that.
You should specify parameters in the Command line arguments box:
The problem might be stemming from the second path in your argument. Try wrapping whatever the C:\Program Fi (it's cut off in the screenshot) path is in quotes.
C:\windows\system32\cmd.exe start /m "" "C:\Program Files(x86)\Path\To\Directory"

Troubles with opening cyrillic file path from explorer in Windws XP

Operating system: Windows XP SP3
Trying to define commands to open some file-types from context menu or directly from explorer and having the following problem:
standard "C:\Program Files\SQLite ODBC Driver\sqlite3.exe" "%1" isn't working if file is in directory that contains cyrillic (non-ASCII) characters;
command "C:\Program Files\SQLite ODBC Driver\sqlite3.exe" "%~s0" isn't working because specified argument template unfortunately is only for batch files;
variant with creating batch file with previous command is ugly and unneficient.
Is there a right or convenient way to open files with non-ASCII characters in path?
Without ugly magic I mean.
UPDATE:
I think that "C:\Dir one\0016~1\file.sqlite" format would work.
%L key isn't working too.
Found the solution. Still ugly but it mades the deal.
...used a command like:
short.cmd "myapp.exe" "%1"
where short.cmd contains the line
start %~s1 %~s2
This then converts the app name and the filename to short versions, and
executes as desired - but there is a command window that pops up briefly in
there (running the START command)
Link: Context menu shell commands %1, %L parameters

Passing parameters to psql.exe

I want to launch psql.exe from an application. The user locates the script, so it could be anywhere on his disk, and the application just feeds that script to psql. That's about it.
What's the correct command line for that ?
I tried this with no success
"C:\Program Files\PostgreSQL\9.1\bin\psql.exe" TEST SYSADM -f "C:\Documents and Settings\Administrateur\Mes documents\TD6.0\FETCHING\install.sql"
I tried with quotes, without the quotes, none worked, it's just ignoring the arguments (tried this on cmd.exe)
C:\Documents and Settings\Administrateur>"C:\Program Files\PostgreSQL\9.1\bin\psql.exe" TEST SYSADM -f "C:\Documents and Settings\Administrateur\Mes documents\TD6.0\FETCHING\install.
sql"
psql: warning: extra command-line argument "-f" ignored
psql: warning: extra command-line argument "C:\Documents and Settings\Administrateur\Mes documents\TD6.0\FETCHING\install.sql" ignored
Password for user SYSADM:
Yes, if the script is in the same directory as psql.exe, and if I CD first to where psql.exe is installed, that means no quotes, no absolute paths and it works fine. However, in my case, I want the application to work on any windows installation, that means psql.exe could be anywhere and the sql script also could be anywhere. I still want the script to be fed to psql.exe.
Try this:
"C:\Program Files\PostgreSQL\9.1\bin\psql.exe" -f "C:\Documents and Settings\Administrateur\Mes documents\TD6.0\FETCHING\install.sql" TEST SYSADM
Save the commands below as a BATch file (install.bat, etc).
Note the 'defaultValueHere'. You can set the default value in case your user skips the entry.
SET installScript=defaultValueHere
SET /P server="Enter the install script location [%installScript%]: "
ECHO you typed %installScript%
PAUSE
"C:\Program Files\PostgreSQL\9.1\bin\psql.exe" TEST SYSADM -f %installScript%
Instruct the user to launch the installation from the install.bat file. Also see my answer on passing parameters to the SQL script.

How can I get Visual Studio to use /RunExit and provide my programs command line arguments?

I have a solution file for a command line executable. I want to run my executable, with different inputs, through the debugger without my interaction, while also setting its output to a log file.
For example, this is sort of what I want:
devenv /DebugExe "myprogram.exe" "my inputs"
That loads VS and automatically sets my programs inputs. However, I want to do this over and over with different inputs to my program and mine the output files later. So the closest I've figured out, but doesn't work, is this:
devenv /RunExit "myprogram.exe" "my input set" /Out out1.log
devenv /RunExit "myprogram.exe" "a different input set" /Out out2.log
...
Is there any way to do this? Again, the important part is that I could queue up a bunch of runs and mine the output files later for their output.
While I did find a way to do what I want, I don't like it. So I'll wait a while before marking my own answer as accepted.
What I really needed and wanted was what I stated in my question:
devenv /RunExit sln "input args" /Out out.log
The problem is that VS doesn't allow this, "input args" is invalid - unlike if you were to use say /DebugExe but then there is manual work involved again and that didn't help me. So in the script I'm using to call devenv dynamically, I used a regex to replace the "Arguments = " line in the sln file with the appropriate arguments each time. Then this command line works:
devenv /RunExit sln /Out out%x%.log
Each call the sln is modified to contain the new set of args and so each run, I'll get different output in my out%x%.log file (which I name differently each run so I can keep track of which log file went to which inputs). Thanks everybody for watching.
I wanted to do something similar: in my case one of my parameters was a file system path, which could contain a space, which would have to be quoted, inside the string in the batch file which must be quoted. I enhanced my command line executable's code to also look at environment variables (Environment.GetEnvironmentVariable) in addition to the command line parameters to it. Then just set the specific environment variable value prior to each invocation of devenv.

Resources