Execute CMD commands using C++

You can execute Windows Command prompt commands using a C++ function called system();. For safer standards you are recommended to use Windows specific API’S like ShellExecute or ShellExecuteEx. Here is how to run CMD command using system() function. You should place the CMD command like shown below in the program source code: system(“CMD_COMMAND”); Here is … Read more

How to escape ampersands, semicolons, and curly braces in command-line powershell params?

powershell .\makeConfig.ps1 -password “‘xxx<xxxx;xxxxx&x.xxxx}xx/xxx'” -otherparam 3 Here outer ” double quotes would escape all cmd poisonous characters e.g. <, & etc. excepting ” itself and % percentage sign (and ! exclamation mark if delayed expansion is enabled) while inner ‘ apostrophes (single quotes) would escape all powershell ones (excepting ‘ apostrophe itself). However, exceptions noticed … Read more

Create a batch file to run an .exe with an additional parameter

in batch file abc.bat cd c:\user\ben_dchost\documents\ executible.exe -flag1 -flag2 -flag3 I am assuming that your executible.exe is present in c:\user\ben_dchost\documents\ I am also assuming that the parameters it takes are -flag1 -flag2 -flag3 Edited: For the command you say you want to execute, do: cd C:\Users\Ben\Desktop\BGInfo\ bginfo.exe dc_bginfo.bgi pause Hope this helps

Bash in Git for Windows: Weirdness when running a command with CMD.exe /C with args

This is actually documented in the ReleaseNotes file (in the top level folder of your installed Git for Windows) Also, extra care has to be paid to pass Windows programs Windows paths, as they have no clue about MSys style POSIX paths — You can use something like $(cmd //c echo “$POSIXPATH”). If you use … Read more

How can I run a PowerShell script with white spaces in the path from the command line?

The -File parameter If you want to run powershell.exe -File from the command line, you always have to set paths with spaces in double quotes (“). Single quotes (‘) are only recognized by PowerShell. But as powershell.exe is invoked (and hence the file parameter processed) by the command line, you have to use “. powershell.exe … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)