Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
naraen87
- Posts: 17
- Joined: 21 Dec 2017 06:41
#1
Post
by naraen87 » 22 Mar 2018 06:46
Hi,
I've a script for xlsx to csv and also that is working fine for me in cmd prompt, while running the same script from Jenkins I'm getting a error like
Code: Select all
C:\Users\SVCT-WI-Jenkins\Desktop\Post_Patching\Mapping_Server\Excel2csv.vbs(9, 1) Microsoft Excel: Microsoft Excel cannot access the file 'C:\Users\SVCT-WI-Jenkins\Desktop\Post_Patching\Mapping_Server\WI_non_cluster_server_list.xlsx'. There are several possible reasons:
The file name or path does not exist.
The file is being used by another program.
The workbook you are trying to save has the same name as a currently open workbook
Is anyone please help me on this.
-
Squashman
- Expert
- Posts: 4486
- Joined: 23 Dec 2011 13:59
#2
Post
by Squashman » 22 Mar 2018 09:08
We really don't do Jenkins support here. If you have a specific question about jscript, vbscript or batch files, please post the code and ask a question about it.
-
ShadowThief
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
#3
Post
by ShadowThief » 22 Mar 2018 13:32
That's a pretty straightforward error message. The file either doesn't exist or is currently open somewhere.
-
SIMMS7400
- Posts: 546
- Joined: 07 Jan 2016 07:47
#4
Post
by SIMMS7400 » 23 Mar 2018 06:43
I just ran into this issue last week when trying to execute a batch process which called multiple VB Scripts via TIDAL Scheduler (same concept as Jenkins).
Have a look at this link and add the correct path provided based on your machine and add appropriate permission to the "Desktop" folder. Then re-execute. I'd bet this week's pay that's your issue.
https://stackoverflow.com/questions/710 ... esheet-app
When you read it, read the WHOLE thing. Keep in mind this tidbit of information:
Code: Select all
The point is that WOW64 stands for Windows on Windows64, that means it actually applies for 32-bit programs running on the 64bit OS.
Since I have 64-bit Excel installed, the proper directory turned out to be the c:\windows\system32\config\systemprofile\desktop
Here is my XLSX to CSV conversion vb script:
Code: Select all
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::-- Script Name: XLSX_2_CSV.vbs
'::--
'::-- Description: This script converts *.xls* files to *.csv
'::
'::
'::-- Calls:
'::-- Called By: HC_SUBMSSN_PUBLISH.cmd
'::
'::-- Parameters: Called by HC_SUBMSSN_PUBLISH to get arguments to determine:
'::--
'::-- 1. Input Name
'::-- 2. Output Name
'::
'::
'::-- Author: Joe Shmoe
'::-- Date: 06/13/17
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Set objExcel = CreateObject("Excel.application")
objExcel.application.visible=false
objExcel.application.displayalerts=false
'::-- Identify Args passed in from batch file --::'
Set objArgs = WScript.Arguments
InputName = objArgs(0)
OutputName = objArgs(1)
'::-- Open *.xls* files and save-as *.csv --::'
set objExcelBook = objExcel.Workbooks.Open(InputName)
objExcelBook.SaveAs OutputName, 51
objExcel.Application.Quit
objExcel.Quit
Let us know - thanks!