My system path is:
C:\Users\angus\algs4\java\bin;C:\binaryTools\SMLNJ\bin\;C:\Program Files (x86)\Python36-32\Scripts\;C:\Program Files (x86)\Python36-32\;C:\Program Files\Java\jdk1.8.0_66\bin;C:\ProgramData\Oracle\Java\javapath;C:\binaryTools;C:\Program Files (x86)\ActiveState Komodo IDE 8\;C:\PHP\;C:\Program Files (x86)\Haskell\bin;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\lib\extralibs\bin;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\bin;C:\MinGW\msys\1.0\bin;C:\MinGW\bin;C:\Program Files\Java\jdk1.8.0_66\bin;c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Services\IPT\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;C:\Program Files\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\mingw\bin;C:\Python33;C:\Python33\Scripts;C:\Program Files\Microsoft Platform SDK\Bin\.;C:\Program Files\Microsoft Platform SDK\Bin\WinNT\.;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Collaborator Client;C:\Program Files\doxygen\bin;C:\Program Files\TortoiseGit\bin;
And I am trying to update a registry key (the system path) using a script but am getting a wierd error:
>myscript.cmd
\Python36-32\Scripts\ was unexpected at this time.
How can I fix the script error?
Here is the script:
echo off
SET PROGPATH=C:\dell\mypath
for /f "tokens=2*" %%a in ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path') do set "SysPath=%%~b"
echo system path is: %SysPath%
echo %SysPath%>tmppath.txt
echo %PATH% | findstr /i %PROGPATH%
if %ERRORLEVEL% EQU 1 (
echo %PROGPATH% path not found in system path
REM we now add to syspath and then write back to registry
set UPDATEDPATH=%PROGPATH%;%SysPath%
REM we now just write UPDATEDPATH back to registry
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /f /v "Path" /t REG_SZ /d "%UPDATEDPATH%"
echo %PROGPATH% should now be added to the system path
) else (
echo %PROGPATH% already in path
)
The problem line is: echo %PATH% | grep %PROGPATH%
you get the error wherever there is a
C:\Program Files (x86)\Java\jre1.8.0_45\bin;
or something like that.
ie the (x86)\J or (x86)\P etc
So how to fix that?
Was asked for more details. So here.
Before running script, my env is like this:
keyname:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
Path key has value:
C:\Users\angus\algs4\java\bin;C:\binaryTools\SMLNJ\bin\;C:\Program Files (x86)\Python36-32\Scripts\;C:\Program Files (x86)\Python36-32\;C:\Program Files\Java\jdk1.8.0_66\bin;C:\ProgramData\Oracle\Java\javapath;C:\binaryTools;C:\Program Files (x86)\ActiveState Komodo IDE 8\;C:\PHP\;C:\Program Files (x86)\Haskell\bin;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\lib\extralibs\bin;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\bin;C:\MinGW\msys\1.0\bin;C:\MinGW\bin;C:\Program Files\Java\jdk1.8.0_66\bin;c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Services\IPT\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;C:\Program Files\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\mingw\bin;C:\Python33;C:\Python33\Scripts;C:\Program Files\Microsoft Platform SDK\Bin\.;C:\Program Files\Microsoft Platform SDK\Bin\WinNT\.;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Collaborator Client;C:\Program Files\doxygen\bin;C:\Program Files\TortoiseGit\bin;
>echo %PATH%
C:\Users\angus\algs4\java\bin;C:\binaryTools\SMLNJ\bin\;C:\Program Files (x86)\Python36-32\Scripts\;C:\Program Files (x86)\Python36-32\;C:\Program Files\Java\jdk1.8.0_66\bin;C:\ProgramData\Oracle\Java\javapath;C:\binaryTools;C:\Program Files (x86)\ActiveState Komodo IDE 8\;C:\PHP\;C:\Program Files (x86)\Haskell\bin;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\lib\extralibs\bin;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\bin;C:\MinGW\msys\1.0\bin;C:\MinGW\bin;C:\Program Files\Java\jdk1.8.0_66\bin;c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Services\IPT\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;C:\Program Files\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\mingw\bin;C:\Python33;C:\Python33\Scripts;C:\Program Files\Microsoft Platform SDK\Bin\.;C:\Program Files\Microsoft Platform SDK\Bin\WinNT\.;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Collaborator Client;C:\Program Files\doxygen\bin;C:\Program Files\TortoiseGit\bin;C:\Users\angus\algs4\bin;C:\Users\angus\algs4\java\bin;C:\Users\angus\AppData\Roaming\cabal\bin;C:\Program Files\Microsoft Platform SDK\Bin\.;C:\Program Files\Microsoft Platform SDK\Bin\WinNT\.;C:\binaryTools\emacs-24.5-bin-i686-mingw32\bin;C:\windows;C:\windows\system32;C:\Users\angus\AppData\Roaming\Dashlane\4.7.1.28771\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\components;C:\Users\angus\AppData\Roaming\Dashlane\4.7.1.28771\ucrt
now if I run the batch file contents above which I named path3.cmd I get:
>path3.cmd
\Python36-32\Scripts\ was unexpected at this time.
>
Trying
echo %PATH% | findstr /i /c:"%PROGPATH%"
or
echo "%PATH%" | findstr /i /c:"%PROGPATH%"
makes no difference.
The bug seems to be in this line:
set UPDATEDPATH=%PROGPATH%;%SysPath%
Related
I installed powershell 7, which set itself as the default shell. It messed up some apps, and I removed it. However, it's still registered as the default shell in some places. One of them is VS2022. When I build my project:
2>Target PostBuildEvent:
2> The system cannot find the path specified.
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: The command "setlocal
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: "C:\Program Files\PowerShell\7\pwsh.exe" -noprofile -executionpolicy Bypass -file C:/prj-external-libs/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/8/_tmp/cpp/build/src/Debug/proj.exe -installedDir C:/prj-external-libs/vcpkg/installed/x64-windows/debug/bin -OutVariable out
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmEnd
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmErrorLevel
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: exit /b %1
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmDone
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :VCEnd" exited with code 3.
2>Done building target "PostBuildEvent" in project "proj.vcxproj" -- FAILED.
2>
2>Done building project "proj.vcxproj" -- FAILED.
I think in general it's done via: options> environment> terminal> restore default.
However, in my case, the issue was with cmake vcpkg, which created a post build event using power shell 7. Need to delete (or just ignore) this event, or rebuild a fresh cmake.
I have a list of paths and a list of executables files that I need to concatenate together and look for each file under each said path. However, when I run my code, I am seeing that the executables are not being concatenated, just added as a new line. Additionally, it is only being added to the last object in the list. See code, output, and desired output below:
Code:
$final_paths = #();
$paths = #("C:\Program Files\Microsoft Office\Office15", "C:\Program Files\Microsoft
Office Servers\OFFICE15");
$exes = #("MSOCF.DLL", "access.exe", "word.exe", "wordCnv.exe", "WordViewer.exe", "Excel.exe", "ExcelCnv.exe", "ExcelViewer.exe", "PowerPoint.exe",
"PowerPointViewer.exe", "PowerPointCnv.exe", "Publisher.exe", "Project.exe", "OneNote.exe", "InfoPath.exe Groove.exe", "FrontPage.exe",
"SharePointDesigner.exe", "Visio.exe", "VisioViewer.exe", "Lync.exeOutlook.exe", "WINPROJ.EXE")
foreach ($exe in $exes)
{
$final_paths += $paths"\$exe";
write-output $final_paths;
}
foreach ($found_path in $final_paths)
{
$file = Get-Item -Path $found_path -ErrorAction Ignore;
Write-Output $file
Sample Output:
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
Excel.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
ExcelCnv.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
ExcelViewer.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
PowerPoint.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
PowerPointViewer.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
PowerPointCnv.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
Publisher.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
Project.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
OneNote.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
InfoPath.exe Groove.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
FrontPage.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
SharePointDesigner.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
Visio.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
VisioViewer.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
Lync.exeOutlook.exe
C:\Program Files\Microsoft Office\Office15
C:\Program Files\Microsoft Office Servers\OFFICE15
WINPROJ
...
...
...
you get the idea
Desired Output:
I simply want nothing but the file name returned as a string, like so:
WIINPROJ
Why try and concatenate paths into full names and then try to figure out using Get-Item if that file exists or not?
Using Get-ChildItem things would be a lot easier, because
it can handle an array of folder paths in the -Path parameter
you get only FileInfo objects returned for the specific files you filter through a Where-Object clause so you don't need to check their existance afterwards
you get a lot more information than just the file name, so you can decide later what it is exactly you want in the output
$paths = 'C:\Program Files\Microsoft Office\Office15', 'C:\Program Files\Microsoft Office Servers\OFFICE15'
$exes = 'MSOCF.DLL', 'access.exe', 'word.exe', 'wordCnv.exe', 'WordViewer.exe', 'Excel.exe', 'ExcelCnv.exe', 'ExcelViewer.exe', 'PowerPoint.exe',
'PowerPointViewer.exe', 'PowerPointCnv.exe', 'Publisher.exe', 'Project.exe', 'OneNote.exe', 'InfoPath.exe Groove.exe', 'FrontPage.exe',
'SharePointDesigner.exe', 'Visio.exe', 'VisioViewer.exe', 'Lync.exeOutlook.exe', 'WINPROJ.EXE'
$files = Get-ChildItem -Path $paths -File | Where-Object { $exes -contains $_.Name }
Now you decide what property you want to retrieve from the $files collection
# just the Name?
$files.Name | Select-Object -Unique # unique in case you found the same exe in both folders
# the Fullname perhaps?
$files.FullName
You can use the Path.Combine method from System.IO for this:
$finalPaths = foreach($path in $paths)
{
foreach($exe in $exes)
{
Get-Item ([System.IO.Path]::Combine($path, $exe)) -EA Ignore
}
}
$finalPaths.Name # => Should be the Names of the files found
Alternatively, as Lee_Dailey suggested in his comment, you can use Join-Path to achieve the same result:
$finalPaths = foreach($path in $paths)
{
foreach($exe in $exes)
{
Get-Item (Join-Path $path -ChildPath $exe) -EA Ignore
}
}
Using CMake (version 3.13.2) to build a shared C library on Windows with MSVC compiler (version 19.16.27025.1).
I get the following error:
Erreur MSB3073 La commande "setlocal
cd "\\vmware-host\Shared Folders\Documents\funnel\build\getopt"
if %errorlevel% neq 0 goto :cmEnd
"C:\Program Files\CMake\bin\cmake.exe" -E __create_def "//vmware-
host/Shared
Folders/Documents/funnel/build/getopt/getopt.dir/Debug/exports.def"
"//vmware-host/Shared
Folders/Documents/funnel/build/getopt/getopt.dir/Debug//objects.txt"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" s'est arrêtée avec le code 1.
Some excerpts of the CMakeLists.txt files defining the build options:
# CMakeLists.txt in root
add_compile_options(/Wall /c)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_subdirectory(getopt)
# CMakeLists.txt in root/getopt
set(src_files getopt.c getopt1.c)
set(hdr_files ansidecl.h getopt.h)
add_library(getopt SHARED "${src_files}" "${hdr_files}")
(Building STATIC library on Windows is OK. Building SHARED library on Linux with gcc is OK.)
-- EDIT (answering vre's comment) --
Running set_target_properties before call to add_library yields the following error.
set_target_properties Can not find target to add properties to: getopt
Running cmake with the proposed generator yields the following (probably because the compiler is not installed on my system though it is proposed in the list returned by cmake -H: installing this version would help?).
-- Selecting Windows SDK version to target Windows 10.0.17763.
CMake Error at CMakeLists.txt:6 (project):
Failed to run MSBuild command:
MSBuild.exe
to get the value of VCTargetsPath:
Le fichier spécifié est introuvable
Running cmake --build [...] from console (having previously generated the build system with Visual Studio 15 2017) yields the following error.
"\\vmware-host\Shared Folders\Documents\funnel\build\ALL_BUILD.vcxproj" (cible par défaut) (1) ->
"\\vmware-host\Shared Folders\Documents\funnel\build\src\exe.vcxproj" (cible par défaut) (3) ->
"\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt.vcxproj" (cible par défaut) (4) ->
(PreLinkEvent cible) ->
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(13
3,5): error MSB3073: La commande "setlocal [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: cd "\\vmware-host\Shared Folders\Documents\funnel\build\getopt" [\\vmware-host\Shared Folders\Docume
nts\funnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt
.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -E __create_def "//vmware-host/Shared Folders/Documents/funne
l/build/getopt/getopt.dir/Release/exports.def" "//vmware-host/Shared Folders/Documents/funnel/build/getopt/getopt.dir/R
elease//objects.txt" [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt
.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: :cmEnd [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [\\vmware-host\Shared Folders\Documents\fu
nnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: :cmErrorLevel [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: exit /b %1 [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: :cmDone [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt
.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: :VCEnd" s'est arrêtée avec le code 1. [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\ge
topt.vcxproj]
When I run the command set programfiles in the command prompt, I get
ProgramFiles=C:\Program Files (x86)
ProgramFiles(x86)=C:\Program Files (x86)
However, the following code in python
import os
print os.getenv("programfiles")
or
msgbox %A_ProgramFiles% and %ProgramFiles%
in Autohotkey
or
$env:ProgramFiles
in PowerShell
all results in C:\Program Files
I cannot understand why I'm getting different results for the Program Files Environment Variables in Windows
What you see is the difference between a 32-bit and 64-bit application.
32-bit cmd.exe (%SystemRoot%\SysWOW64\cmd.exe)
C:\>set programfiles
ProgramFiles=C:\Program Files (x86)
ProgramFiles(x86)=C:\Program Files (x86)
64-bit cmd.exe (%SystemRoot%\System32\cmd.exe)
C:\>set programfiles
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
32-bit powershell.exe (%SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe)
PS C:\> dir env:\programfiles*
Name Value
---- -----
ProgramFiles(x86) C:\Program Files (x86)
ProgramFiles C:\Program Files (x86)
64-bit powershell.exe (%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe)
PS C:\> dir env:\programfiles*
Name Value
---- -----
ProgramFiles(x86) C:\Program Files (x86)
ProgramFiles C:\Program Files
I have tried something like this but did not work:
#echo off
call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC"
mstest /testcontainer: mytest.dll
save as .bat file and when i double click it does nothing.
So, I am trying to open command prompt located in visual studio and execute.
Are you trying to change the directory to "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC"?
Try this:
#echo off
CD "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC"
mstest /testcontainer: mytest.dll
PAUSE
Your batch file seems to be a little out of shape there. I'm no expert, but you have:
call "C:\Program Files\Microsoft Visual Studio 2008\VC\"
...but without a batch file name. See this for info.
If mstest is your batch file name then the call should be more like:
call "C:\Program Files\Microsoft Visual Studio 2008\VC\mstest.bat " <arguments>