command prompt conversion of TC to TE - testcomplete

I want to convert a project built in TestComplete to TestExecute using a .bat command
Due to the project being part of CI process new versions are released daily and conversion needs to occur automatically ;
.bat file for running project :
net use O: /delete
net use O: %1 /persisten:no
echo %PATH%
IF EXIST "C:\Program Files (x86)\SmartBear\TestExecute 12" (
**I would like to enter conversion of project here**
"C:\Program Files (x86)\SmartBear\TestExecute 12\Bin\TestExecute.exe" "O:\Diamond.pjs"
) ELSE (
echo "test execute 12 not installed"
)
net use O: /delete

You can force conversion at the same time when running the project:
"C:\Program Files (x86)\SmartBear\TestExecute 12\Bin\TestExecute.exe" "O:\Diamond.pjs" /SilentMode /ForceConversion

Related

Visual studio 2017 Developer Command Prompt switches current directory

I am getting weird behavior of "Developer Command Prompt for VS 2017" command line tool. Normally in previous versions of visual studio this script (VsDevCmd.bat) was not messing current directory from where you run it. Now it seems to change it. One simple workflow would be just to start the shortcut "Developer Command Prompt for VS 2017" and it doesn't honor the "Start in" directory:
By any chance anyone seen this issue? It really bugs me because I used to have a shortcut with it and start CMD in my source directory, use TFS/msbuild commands afterwards.
You can set the VSCMD_START_DIR environment variable to have vsdevcmd.bat change to that directory when it finishes. Otherwise it will check if you have a %USERPROFILE%\source directory and change to that (which is what you see).
You can change the "Target" for the "Developer Command Prompt for VS 2017" to something like the following to have change to a particular directory:
%comspec% /k "set VSCMD_START_DIR=C:\temp && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\VsDevCmd.bat""
Note that the path to vsdevcmd.bat needs to be put in an additional set of double quotes.
Alternatively, rename or remove the %USERPROFILE%\source directory (Note that this seems to be some kind of new "standard" directory for sources), that will make vsdevcmd.bat honor the "Start In"-value (i.e. "current directory").
:: Some rocket scientist in Redmond made the VS15 VsDevCmd.bat change the cwd; the pushd/popd fixes that.
pushd %CD%
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\VsDevCmd.bat"
popd
"C:\Program Files (x86)\CruiseControl.NET\server\ccnet.exe" %*
vsdevcmd_end.bat, REM out the line:
cd /d "%USERPROFILE%\Source"
#REM Set the current directory that users will be set after the script completes
#REM in the following order:
#REM 1. [VSCMD_START_DIR] will be used if specified in the user environment
#REM 2. [USERPROFILE]\source if it exists
#REM 3. current directory
if "%VSCMD_START_DIR%" NEQ "" (
cd /d "%VSCMD_START_DIR%"
) else (
if EXIST "%USERPROFILE%\Source" (
cd /d "%USERPROFILE%\Source"
)
)
If I see your quastion in right way that I'm used to work with EntityFramework Core with the help of CMD or PowerShell. For this you should right-click In the Solution Explorer panel then in the context menu, click Open Folder in File Explorer. In the address bar of the file explorer type cmd or powershell, you will start the command line from the project folder.

Navigate to a specified path in cmd file

Now I am currently in C:\WINDOWS\system32>
I need to mention it in the cmd file
How can I navigate to a specific path in cmd file.
Please provide the lines.
#echo off
setlocal
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
cd "C:\hadoop-2.6.0-src"
mvn package -Pdist,native-win,docs -DskipTests -Dtar
pause
popd
This is my cmd file.The mvn command is not getting executed in the specified path. two separate command prompts is getting opened but it is not running and get closed immediately
Thanks in advance.
PUSHD Change the current directory/folder and store the previous folder/path for use by the POPD command
#echo off
setlocal
pushd "C:\hadoop-2.6.0-src"
cd
pause
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
cd
pause
popd
Additional cd commands (without parameters) should display the current drive and directory.
Read more

How can I perform different actions in windows batch file based on most recent version of installed program

Some of our computers run multiple versions of Microsoft Access (97 & 2010) while others run 365. For the pcs running multiple versions, the default is set to 97. I have a batch file that is performing various tests to see if files exist, and finished by running an Access 2010 database called MWO.accdb. See below.
if exist c:\windows\system32\mscomct2.ocx goto step2
rem copy mscomct2 and register
cscript \\file\apps\Database\Maintenance\365\MsgBox.vbs "Preparing necessary libraries."
copy "\\file\apps\Database\Maintenance\365\mscomct2.ocx" "c:\windows\system32\"
regsvr32 /u mscomct2.ocx
regsvr32 /i mscomct2.ocx
:step2
if exist "%USERPROFILE%\Desktop\MWO.lnk" goto step3
rem create shortcut on user's desktop for future use
cscript \\file\apps\Database\Maintenance\365\MsgBox.vbs "Creating shortcut on desktop & adding to start menu."
copy "\\file\apps\Database\Maintenance\MWO-INSTALL.lnk" "%USERPROFILE%\Desktop\MWO.lnk"
mkdir "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Maintenance"
copy "\\file\apps\Database\Maintenance\MWO-INSTALL.lnk" "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Maintenance\MWO.lnk"
:step3
\\file\apps\Database\Maintenance\365\MWO.accdb
Is there an easy way to test for the latest version of access, and force the file to open with it to avoid the defaulting to 97 problem?
wmic product where caption="Access" get caption,version
(I don't have access installed, the captionstring may differ)

execute 2 commands in File shortcut

I am using Windows 7 professional.
I have auto generated file shortcut for the program.
I need to delete one folder before starting the program every time.
Can I automatize it without creating .bat file? e.g. using this command del \directory\path\* /g "C:\Program Files (x86)\program.exe" in the shortcut properties.
Yes you can do this:
C:\Windows\System32\cmd.exe /C "del \directory\path\* /Q & "C:\Program Files (x86)\program.exe"
The & sign tells the shell to run several commands in sequence.

SQL Server setup.exe within a custom msi causes StackOverflowException

I'm trying to create an .msi installer that also installs SQL Server (if the user has the disk/iso file).
How it should work is:
it runs a batch file, and the batch file finds the setup.exe in whichever drive it is.
The batch file takes 2 arguments, the location of the configuration file and the install directory of the msi
it then searches for setup.exe and runs it with the config file, performing a silent install.
The arguments seem to be exactly the same which ever way I run it.
#echo off
::this file searches for the setup.exe and then installs the server.
::ARGUMENTS:Complete Path to the Configuration File
::ATTENTION: this will need to search for a more unique file in the future!
::loop through each letter for a drive
for %%A in (D E F G H I J K L M N O P Q R S T U V W X Y Z) Do (
::check if file exists, send any error messages to NUL, destroying it(e.g. no disk in drive) and installif found
DIR "%%A:/setup.exe" 1>NUL 2>&1 && call:install %%A %1 %2
::if we reach here the file ahsn't been found
if %%A == Z (
#echo Please insert the Microsoft SQL Server 2008 R2 disk and try again.
pause
exit
)
)
:install
net user grp-db ..grp.. /add
echo Installing SQL Server 2008 R2 with %~2
date/t
time /t
::"%~1:\setup.exe" /ConfigurationFile="%~2"
DIR "%~2"
date/t
time /t
pause
echo Creating ODBC data source.. with %~3
::"%~3"ODBCCONF.exe CONFIGSYSDSN "SQL Server" "DSN=GRP_DSN | Description=GRP Data Source | SERVER=(local) | Trusted_Connection=Yes"
exit
goto:eof
Running the batch file from Command Prompt works perfectly as expected but in the msi it causes a StackOverflowException. Checking the Summary file in the SQL directory says
The user cancelled the operation. Exception type: Microsoft.SqlServer.Chainer.Infrastructure.CancelException.
Has anybody got ANY ideas where to even start with this one?
It looks like there is a conflict between the SQL Server installation and your MSI process.
Instead of using a BAT for installing SQL Server, you can try adding it as a prerequisite for your MSI:
http://msdn.microsoft.com/en-us/library/77z6b8tz(VS.80).aspx
http://msdn.microsoft.com/en-us/library/ms165429(VS.80).aspx?ppud=4

Resources