SSIS: Cannot open datafile (path is correct) - windows

I'm trying to generate a csv running a SSIS package.
First, I've created a string variable DATA_PATH (same name as windows system variable). Then, I've set a Process Task which run an echo to a Windows system variable like this:
The output of the command set my variable DATA_PATH correctly.
When I run the package, it throws the error "[Destino de archivo plano 1 [44]] Error: Cannot open the datafile (...)". But, if I hardcode my SSIS variable with the same exact file path as the echo %DATA_PATH% output, the package run correctly, without any error.

Related

I was trying to run yarn,but am getting this issue.Yarn is installed but cant even access the version

yarn --version
The system cannot find the path specified.
Error: JAVA_HOME is incorrectly set.
Please update C:\Users\shriy\Downloads\hadoop-3.1.0\etc\hadoop\hadoop-env.cmd
'-Dhadoop.log.dir' is not recognized as an internal or external command,
operable program or batch file.
Your java environment path must not contain space. The solution is as follows:
In the cmd line, charge the directory that contain the jdk (in my case C:\Program Files\Java\jdk1.8.0_73).
execute the following line "for %I in (.) do echo %~sI" to display the short name of your installed jdk (in my case C:\PROGRA~1\Java\JDK18~1.0_7)
in the file "hadoop-env.cmd", change the line "JAVA_HOME=%JAVA_HOME%" with "JAVA_HOME=C:\PROGRA~1\Java\JDK18~1.0_7".
run again the file "hadoop-env.cmd" and it will work correctly.

Can I access environment variable inside a file

Here I'm setting the values in cmd.
cmd> set tb_name="student";
How to access it in a file in same window? Because I will run SQL file from cmd there I need to change table name,.

Automating google cloud SDK installation on windows, GCLOUD is not recognized as an internal or external command

I am using following batch file to download and unzip the google-cloud-sdk,
file name: download.bat
set home=%USERPROFILE%
echo %home%
%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "(New-Object Net.WebClient).DownloadFile('https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-179.0.0-windows-x86_64-bundled-python.zip', '%home%/google-cloud-sdk.zip');& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('%home%/google-cloud-sdk.zip', '%home%/google-cloud-sdk'); }"
and I am using following batch file to install the SDK silently on windows,
file name: install_win.bat
call %USERPROFILE%\google-cloud-sdk\google-cloud-sdk\install.bat --path-update=true --usage-reporting=false --command-completion=false
After these steps are completed successfully when I try to authorize my serice account from another batch file using the following command,
gcloud auth activate-service-account --key-file {json fila path}
It fails and tells me that the glcoud is not recognized internal or external command.
Can anyone please help me solve this error?
I think the error is because of the lack of environment variable in windows with the bin file of SDK.
How to set that from the batch file?
The ...cloud...\install.bat routine is called, hence it inherits the calling routine's environment. It does not communicate any changes back to the calling routine.
Since I'd assume that the install.bat is supplied by a 3rd party, hence cannot be altered, then you would need to retrieve the new path for the current cmd instance.
call %USERPROFILE%\...\install.bat ...
FOR /f "delims=" %%a IN ('echopath') DO SET "newpath=%%a"
where echopath.bat is simply one line:
echo %path%
Provided echopath.bat is reachable - and it must be a separate file, not an internal routine - the new path should be returned (to newpath in this instance - I'll let you guess what changes you'd need to make to change that to path...)
Since executing an external batch loads the environment anew, the modified environment path will be reported by echopath and hence assigned to the variable nominated.

Set environment variable in nested batch file

I am trying to factor out a piece of a batch file that sets an environment variable to another batch file. This piece is somewhat involved and I would rather not repeat it in multiple batch files. I won't over-complicate this post with the actual code I'm trying to run in the nested batch file, but will provide a simple example that shows what I'm trying to do and reproduces the problem.
Batch1.cmd
cmd.exe /c setvar.cmd abc def
set abc
setvar.cmd
set var=%1
set val=%2
set %var%=%val%
The error returned for "set abc" in Batch1.cmd is this:
Environment variable abc not defined
I imagine cmd.exe starts up a new environment, because on return to Batch1.cmd, the variable does not exist.
Is there a way I can nest a batch file and keep the environment it creates?
The environment block is not shared between processes. As you are starting a new cmd instance a separate environment block is created, changed and destroyed before returning the control to the current batch file, that will not see any change as it was done in a different process.
Use call setvar.cmd abc def to start the nested batch file in the current process.
Use the setx <var> <val> command to set an environment variable more persistently. For example:
setx WEBCAM_ADDR 192.168.0.101
(Note: There is NO equals sign (=) as with the regular set command)
I just went through this issue, trying to run batch files from windows. This is better than having to write, say, a configuration file somewhere...

Unable to open application by specifying it's location under App Paths

I have created a key(for example myapp.exe) under "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths" with below values in registry.
(Default) --> C:\Program Files\folder1\folder2\myapp.exe
Path --> C:\Program Files\folder1\folder2\;
Then I opened a command prompt and tried to open my application. But I am getting an error like "'myap.exe' is not recognized as an internal or external command,operable program or batch file."
If I add the directory where my application resides to Path environment variable, then I am able to run the application successfully from command prompt.
please let me know where I went wrong.
This is another way to start an application from the command prompt.
Create a batch file similar to the following and call it FR.BAT which is short for foxit reader in this example, and store the FR.BAT file in c:\windows or another directory on the PATH.
When you open a CMD prompt and type fr then it will launch this batch file and start the application.
#echo off
start "" "c:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe"
Just be careful not to use a name which is the same as an existing Windows command.

Resources