insert a variable to cmd command

LabelName doesn’t need to be a shell object, as it’s just a string. Then concatenate the string onto the run command and you are done. Set oShell = WScript.CreateObject(“WScript.Shell”) Dim LabelName LabelName = InputBox(“Please Enter Label to check-out:”, _ “Create File”) oShell.run “cmd /K “”c:\Program Files (x86)\Borland\StarTeam Cross-Platform Client 2008 R2\stcmd.exe”” co -p bla:[email protected]:7777/bla/ -is … Read more

Winapi: Get the process which has specific handle of a file

For this task, starting with Windows Vista special exist FileProcessIdsUsingFileInformation FILE_INFORMATION_CLASS. So we need open file with FILE_READ_ATTRIBUTES (this is possible even if somebody open file with 0 share mode. of if we have no access to file (by it DACL) but have read access to parent directory). and call NtQueryInformationFile with FileProcessIdsUsingFileInformation. on return … Read more

chcp 65001 codepage results in program termination without any error

To use Unicode in the Windows console for Python 2.7 and 3.x (prior to 3.6), install and enable win_unicode_console. This uses the wide-character functions ReadConsoleW and WriteConsoleW, just like other Unicode-aware console programs such as cmd.exe and powershell.exe. For Python 3.6, a new io._WindowsConsoleIO raw I/O class has been added. It reads and writes UTF-8 … Read more

How do I make Perl scripts recognize command-line parameters in the Win32 cmd console?

I found out what the problem was. Although the ftype and the assoc values were set as suggested, the actual behavior on my system seems to be determined by the registry key HKEY_CLASSES_ROOT\Applications\perl.exe\shell\open\command It should have a (Default) string value of “C:\Perl\bin\perl.exe” “%1” %* When I found this entry, it was set to “C:\Perl\bin\perl.exe” “%1”. … Read more

windows cmd: problems with for /f with a quoted command with quoted parameters

Here are two solutions. 1) has surrounding double quotes and removed ^ escape character. 2) uses find as it is on the path. for /f %%a in (‘””%systemRoot%\system32\find.exe” /c /v “” < “c:\something.txt””‘) do @echo %%a for /f %%a in (‘ find.exe /c /v “” ^< “c:\something.txt”‘) do @echo %%a It’s to do with launching … Read more