Set oShell = Server.CreateObject ("WScript.Shell")
oShell.run "cmd.exe /C copy ""C:\inetpub\test\test.txt"" ""C:\inetpub\test\test2.txt"" ", 0, true
Hello, I try to run any command from an asp file on my Windows 2003 server but none of them work, my test page loads endlessly when it is executed.
I have already tried to put the pool application in local system but nothing changes.
Have you seen this before ?
Related
I have a problem very similar to this one, but instead of a command line application, I have a ASP.NET Web API project with an Angular project inside of it, created using a dotnet template 'angular' (dotnet new angular --name something. .NET 6.0.401).
When I run the application with dotnet run and open localhost:5097 I get a blank page with a message "Launching the SPA proxy...
This page will automatically redirect to https://localhost:44415 when the SPA proxy is ready." The console constantly prints info: Microsoft.AspNetCore.SpaProxy.SpaProxyMiddleware[0]
SPA proxy is not ready. Returning temporary landing page.
over and over again.
When I enter localhost:44415 I get an error in the console that says
fail: Microsoft.AspNetCore.SpaProxy.SpaProxyLaunchManager[0]
Couldn't start the SPA development server with command 'npm start'.
and a notepad window is opened with content
:: Created by npm, please don't edit manually.
#ECHO OFF
SETLOCAL
SET "NODE_EXE=%~dp0\node.exe"
IF NOT EXIST "%NODE_EXE%" (
SET "NODE_EXE=node"
)
SET "NPM_CLI_JS=%~dp0\node_modules\npm\bin\npm-cli.js"
FOR /F "delims=" %%F IN ('CALL "%NODE_EXE%" "%NPM_CLI_JS%" prefix -g') DO (
SET "NPM_PREFIX_NPM_CLI_JS=%%F\node_modules\npm\bin\npm-cli.js"
)
IF EXIST "%NPM_PREFIX_NPM_CLI_JS%" (
SET "NPM_CLI_JS=%NPM_PREFIX_NPM_CLI_JS%"
)
"%NODE_EXE%" "%NPM_CLI_JS%" %*
which is understandably the same as the npm.cmd's content in my node.js directory. The window name is also "npm.cmd".
As mentioned in the thread I attached previously, I removed a file association for .js in windows settings, but it hasn't changed anything. The last comment there says something about changing the contents of "lb-discover.cmd" file. I don't think an ASP.NET + Angular project has an analogical file to it.
I suspect it might have something to do with file association in windows, but I can't change it for .cmd files.
Thanks in advance.
As suggested by #Yitz - this thing worked
Open your .csproj file for editing, find the following property:
<SpaProxyLaunchCommand>npm start</SpaProxyLaunchCommand>
and change it as follows:
<SpaProxyLaunchCommand>cmd.exe /c npm start</SpaProxyLaunchCommand>
This should work around possible issues with file association for .cmd
I have written a simple VBScript code which:
opens an Excel workbook
makes the Excel workbook visible
update the contents of Cell(1,1) of Sheet1 with the current system time
saves the Excel workbook
The code is as follows:
Option Explicit
Dim objExcel, objBook, objSheet, strPath
strPath = "C:\Users\a614923\Work Repository\Local\Test Complete\Working\05012019\bonn-6.11.9_Regression\FIL_REGRESSION\Stores\Files\ExternalDriver\Test.xlsx"
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.DisplayAlerts = False
Set objBook = objExcel.Workbooks.Open(strPath)
Set objSheet = objBook.Sheets("Sheet1")
objSheet.Cells(1,1) = "Time: " & time
objBook.Save
'objBook.Close
'objExcel.Quit
When I run this VBScript file(directly by double-clicking, not via Jenkins), all the 4 steps mentioned above run fine.
When I run the same file via Jenkins, the following happens:
Excel workbook is opened
the contents of Cell(1,1) of Sheet1 are updated with the current system time
Excel workbook is saved
The issue is that the Excel workbook does not become visible. I have been stuck on this step for hours now. Today is the first time I am using Jenkins. Is there any Jenkins configuration that I am missing? Has anyone ever faced this issue?
I am running Windows batch command on Jenkins to achieve the same:
C:\Windows\SysWOW64\cscript.exe "C:\Users\a614923\Work Repository\Local\Test Complete\Working\05012019\bonn-6.11.9_Regression\FIL_REGRESSION\Stores\Files\ExternalDriver\TEST.vbs"
This is how my build console looks like after running the build:
Started by user Gurmanjot Singh
Building in workspace C:\Program Files (x86)\Jenkins\workspace\SuiteRunner
[SuiteRunner] $ cmd /c call C:\WINDOWS\TEMP\jenkins2976471610072523635.bat
C:\Program Files (x86)\Jenkins\workspace\SuiteRunner>C:\Windows\SysWOW64\cscript.exe "C:\Users\a614923\Work Repository\Local\Test Complete\Working\05012019\bonn-6.11.9_Regression\FIL_REGRESSION\Stores\Files\ExternalDriver\TEST.vbs"
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Jenkins\workspace\SuiteRunner>exit 0
Finished: SUCCESS
Any help/suggestion would be appreciated.
I took help from this answer
To solve the issue, I performed these steps:
Downloaded the generic war package from https://jenkins.io/download/
Ran the jenkins from command line using the command java -jar jenkins.war
Complete the Installation(configure proxy, if any; download plugins, credentials etc)
Entered the batch command
After clicking on Build now, I was able to see the excel getting launched.
I'm trying to build a number of solutions from a cmd file using command lines to handle the whole build
this is the line that builds the solution:
for /f %%i in (%CFG%\bld.lst) do set OUT= %%i Release %REBUILD%& call :out & C:\"Program Files (x86)"\"Microsoft Visual Studio 12.0"\Common7\IDE\devenv.exe %%i %REBUILD% Release >>%LOG%
the solutions are in (%CFG%\bld.lst)
if I add error catching as in:
if errorlevel 1 set OUT= Failed to build %%i Release & goto :error_term at the end of the line the build crashes
if I don't then the eventviewer shows me this error:
The description for Event ID 0 from source VSTTExecution
cannot be found. Either the component that raises this event is not
installed on your local computer or the installation is corrupted. You
can install or repair the component on the local computer.
If the event originated on another computer, the display information
had to be saved with the event.
The following information was included with the event:
(devenv.exe, PID 2004, Thread 1) UIContextHelper.SetUIContext: The call to IVsAggregatableProject.GetCmdUIContextCookie failed. Error code: -2147467259
the message resource is present but the message is not found in the string/message table
if I build each of the solutions from VisualStudio the solution builds correctly
I should mention some of the projects where written in VS 2010 and some in VS 2013
it's turning my hair grey. HELP!
Danieli
I have to run .vbs through classic asp. From past quite a few days, I am working on this, but still can't find a solution.
My code is as follows:
Set oWshShell = Server.CreateObject("WScript.Shell")
'sCmd = "%systemroot%\sysnative\cmd.exe"
'oWshShell.run "c:\windows\system32\cmd.exe", 1, TRUE
'oWshShell.run("%comspec% /c "C:\inetpub\wwwroot\sharedagents\print.vbs",1,TRUE)
'owshshell.run sCmd
Set oWshShell=Nothing
I tried all the methods that are commented out, but while executing the page, Browser/IIS hangs indefinitely. I have tried all sorts of variation to put in oWshShell, but still I am being able to put it through. I have checked permissions, Registry and all sorts other tweaks that can be possible.
Is it due 32-bit/64-bit issue or something else?
If you are running it on Windows 7 64-bit, your following code must be changed:
from:
'oWshShell.run "c:\windows\system32\cmd.exe", 1, TRUE
to:
'oWshShell.run "c:\windows\SysWOW64\cmd.exe", 1, TRUE
Also, verify if the cmd is running under administrator rules
Windows 7 x64: Execute a 64bit exe/script from a 32bit command prompt? may help you.
I need to install Desktop Experience in Azure Worker Role. Installing DE via the command line can be done with:
c:\servermanagercmd -install Desktop-Experience
And then a reboot is required.
How can I best make this work in Azure Worker Role?
UPDATE:
1) Make sure to use OS Family 2 and SDK >=1.3
2) Use elevated startup task to call included batchfile with this command:
3) servermanagercmd -install Desktop-Experience -restart -resultPath results.xml
I have tried
a) to put that commandline in a batch/.cmd file and run it via an elevated startup task. Result: The worker role keeps Aborting and restarts in a neverending loop.
b) I have tried to create a new Process() in OnStart(), under elevated runtime, something like this:
ServiceDefinition.csdef:
Runtime executionContext="elevated"
WorkerRole.cs:
public override bool OnStart()
{
if (!System.IO.File.Exists("Startup\\InstallationFinished.txt"))
{
Process startup = new Process();
startup.StartInfo.FileName = "Startup\\InstallDesktopExperience.cmd";
startup.StartInfo.CreateNoWindow = true;
startup.EnableRaisingEvents = true;
startup.Start();
startup.WaitForExit();
System.IO.File.WriteAllText("Startup\\InstallationFinished.txt",
"Installation is complete.");
startup.StartInfo.FileName = "Startup\\Reboot.cmd";
startup.Start();
}
base.OnStart();
}
InstallDesktopExperience.cmd:
servermanagercmd -install Desktop-Experience
Reboot.cmd:
shutdown /r
The result is that the Event Viewer in the Azure Worker Role shows an exception from TrustedInstaller (0xc0000005). After this error is shown in the event log, DE cannot be installed manually by opening a command line window and typing the command either. I get the error:
Error: Installation of [Desktop Experience] failed. Attempt to install Desktop Experience failed with error code 0x80080005. Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))
(but it works by doing it manually in a command line window if I haven't run the code in OnStart)
I'm lost. Thanks in advance for any and all suggestions.
You should reference this guide from Wage Wegner. It deals with Expression Encoder, but the prereq of Desktop Experience is exactly the same:
http://www.wadewegner.com/2011/01/using-expression-encoder-4-in-a-windows-azure-worker-role/
Snippet from the same, but you should take the time to read his explanation on some of these concepts
REM : Install the Desktop Experience
ServerManagerCMD.exe -install Desktop-Experience -restart -resultPath results.xml
REM : Make a folder for the AppData
md "%~dp0appdata"
REM : Change the location of the Local AppData
reg add "hku\.default\software\microsoft\windows\currentversion\explorer\user shell folders" /v "Local AppData" /t REG_EXPAND_SZ /d "%~dp0appdata" /f
REM : Install Encoder
"%~dp0\webpicmd\WebPICmdLine.exe" /accepteula /Products: ExpressionEncoder4 /log:encoder.txt
REM : Change the location of the Local AppData back to default
reg add "hku\.default\software\microsoft\windows\currentversion\explorer\user shell folders" /v "Local AppData" /t REG_EXPAND_SZ /d %%USERPROFILE%%\AppData\Local /f
REM : Exit gracefully
exit /b 0