How to run Xbox One ADK with command line - windows

After installed XboxOneADK, there will be a Xbox One ADK Command Prompt.
its target is below:
C:\Windows\system32\cmd.exe /k "C:\Program Files (x86)\Microsoft Durango XDK\adk\DurangoVars.cmd" ADK
Then it can run as a new cmd window. And I can run command in this cmd window.
C:\Program Files (x86)\Microsoft Durango XDK\bin>xbapp.exe xxxxxx
C:\Program Files (x86)\Microsoft Durango XDK\bin>Makepkg.exe xxxxxx
...
I dont't like it's too manual.
How can I run only one command to launch the ADK cmd window with xbapp.exe and Makepkg.exe commands?
Thank you!

Prepare a text file with this contents:
example.txt:
"C:\Program Files (x86)\Microsoft Durango XDK\adk\DurangoVars.cmd" ADK
xbapp.exe xxxxxx
Makepkg.exe xxxxxx
...
exit
And "execute it" this way:
cmd < example.txt

Related

Open Visual Studio Dev prompt and enter sequence of commands

I want to use PowerShell to run a script that:
Launches Visual Studio Developer Command Prompt (VS 2017)
Enters in sequence of commands to do a batch and release build
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\VsDevCmd.bat" && <next sequence of commands to do batch build>
The above code simultaneously opens VS Dev prompt and my sequence of commands. There is no pause after opening the prompt, so the commands do not run.
Screenshot of what happens

How to run devenv.exe command line switches (for Visual Studio 2019) from git bash

My primary use case is I'd like to use devenv.exe /edit command to open files in an already running instance of Visual Studio 2019, using git bash.
The issue I'm having is that I cannot seem to finesse git bash to run the command in a way that actually works.
Specifically, this is what I'm seeing:
from windows cmd:
command: devenv /edit foobar.c
results: SUCCESS!; opens foobar.c in an existing instance of visual studio 2019
from git bash:
command: devenv /edit foobar.c
result: FAIL!; opens a new instance of 2019, and has an error popup saying: The following files were specified on the command line: "C:/Program Files/Git/edit" These files could not be found and will not be loaded. Opens file
from git bash, tucking the command under a .bat file
mybat.bat contents: devenv /edit foobar.c
command: cmd //c mybat.bat
result: FAIL!; Opens a new instance of 2019, no error popup, opens file.
from git bash, using full paths to exe and file
command: "/c/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/devenv.exe" /edit /c/Users/MYNAME/foobar.c
result: FAIL!; opens a new instance of 2019, and has an error popup saying: The following files were specified on the command line: "C:/Program Files/Git/edit" These files could not be found and will not be loaded. Opens file
from git bash, escaping the edit command and and using full paths:
command: "/c/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/devenv.exe" /edit /c/Users/MYNAME/foobar.c
result: FAIL!; Opens a new instance of 2019, no error popup, opens file.
from git bash, after opening the sln via git bash:
command 1: devenv.exe my_solution.sln &
result: Opens my solution
command 2: devenv.exe //edit foobar.c &
result: SUCCESS!; opens foobar.c in an existing instance of visual studio 2019
Command 3 (from a different git bash): devenv //edit foobar.c &
result: FAIL!; Opens a new instance of 2019, no error popup, opens file.
Can anyone think of a method to invoke the command from git bash, in the same fashion that a windows command prompt (cmd.exe) would invoke the command?
The only solution I could find was to put "& "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe" "solution.sln" /Build Release in a .ps1 file and call powershell build.ps1 from my .sh file.

How to execute a shortcut with space in the target field from the command line?

For example, I am trying to execute a Dynamics GP shortcut icon from the command line.
Target is as follows:
"C:\Program Files (x86)\Microsoft Dynamics\GP2018\Dynamics.exe" Dynamics.set
What is the command to execute the following shortcut through Windows command line without double clicking on the shortcut icon in order to open it?
"C:\Program Files (x86)\Microsoft Dynamics\GP2015\Dynamics.exe" "C:\Program Files (x86)\Microsoft Dynamics\GP2015\Dynamics.set"
It took me a few tries to do it, but that worked

Trying to run a command in a changing command prompt

I'm writing a powershell script that remotely gets the workspace info on a remote computer's TFS.
What I need to do is either invoke-command or psexec the path of the batch file to open up the visual studio dev command prompt, and then run a command inside that prompt. What I'm having trouble with is executing the second command inside the dev command prompt. What is happing right now is I'm able to open the dev command prompt, but only when I exit it does the second command run. Below is some code I was trying.
.
Invoke-Command -ComputerName computer1 {cmd /k '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\LaunchDevCmd.bat" & tf'}
^ I get a tf is not recognized, which it isn't when in a normal command prompt. If it ran in the dev prompt I'd get some version info and help commands.
.
#echo off
"C:\Users\me\Downloads\PSTools\PsExec.exe" \\computer1 cmd /c "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\LaunchDevCmd.bat" & "tf"
^ This opens the dev prompt, and upon exiting it gives an error that tf is not a command.
.
What I want to do is: Normal Prompt > Dev Prompt > Run Command > Leave Both. Is this possible? Is there a way to just start at the dev prompt?
You could invoke tf.exe command in your powershell directly:
PS> & "$env:Program Files (x86)\Microsoft Visual Studio\2017\\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe" #("workspace", "/new", "xxx", "/noprompt", "/login:xxx,xxx", "/collection:xxx")

Error when converting batch file to shell script and executing TFS commands

I have a batch file that executes these commands:
set repodir=D:\Folder
cd /d %repodir%
call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86_amd64
tf undo * /recursive /noprompt
tf get
I want to achieve same functionality from shell script. I am able to change the directory path to wherever code is present
Problems:
command call is not found - read that I need to use . operator in shell script. Tried this but not working. Error is "#echo command not found" in vcvarsall.bat ( the first line in that file is #echo off )
. "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86_amd64
Since calling batch file is failing in step 2, command tf is not found
tf undo * /recursive /noprompt
tf get
Environment: I am trying to run the shell script using cygwin on Windows Server 2008
Remove the 'call' because that is for calling one bat file from another.
Specify the full path for tf.exe. Of course that will vary depending on the version of TFS you have installed.

Resources