Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8923433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:07:04+00:00 2026-06-15T07:07:04+00:00

I have created a scriptdirectory let $MYSCRIPTS = $VIM./vimfiles/my_scripts-docs ($VIM = C:\Program Files\Vim) this

  • 0

I have created a scriptdirectory

let $MYSCRIPTS = $VIM."/vimfiles/my_scripts-docs"

($VIM = C:\Program Files\Vim)

this works fine:

exe "e ".expand('$MYSCRIPTS/vim-calc_vb.txt')

This doesn’t work and I can’t find out why:

exe "!awk -f ".expand('$MYSCRIPTS/my-awk-script.awk')  
exe "!awk -f ".expand('$MYSCRIPTS\my-awk-script.awk')

error:
awk: fatal: can’t open source file ‘C:/Program’
It works fine when I put the .awk file in the root but not when
I put it in a vim directory or whatever directory under C:\program files

Why does .txt files expand and .awk files not?
How can I let vim know where the awk file is under vimfiles?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:07:05+00:00Added an answer on June 15, 2026 at 7:07 am

    Why do you need expand() and not just

    fnameescape($MYSCRIPTS.'/vim-calc_vb.txt')
    

    (for the exe "e") and

    shellescape($MYSCRIPTS.'/my-awk-script.awk, 1)
    

    (for !awk …)?

    Based on your

    awk: fatal: can’t open source file ‘C:/Program’
    It works fine when I put the .awk file in the root but not when
    I put it in a vim directory or whatever directory under C:\program files

    I see that absence of shellescape() is the problem here, not expand(), but it does not make the former useful. It is useful for changing \ to / on windows. Just surround your expand() calls with fnameescape()/shellescape(…, 1):

    " None is needed here: `:e` expands `$` on its own
    e $MYSCRIPTS/vim-calc_vb.txt
    
    exe "!awk -f ".shellescape(expand('$MYSCRIPTS\my-awk-script.awk'), 1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created new environment staging. Locally it works. I run it this way:
I have created a little program that reads in a Java file and feeds
We have created a .NET 4 web service, which runs fine on a Windows
Have created a UIButton programmatically, all works as expected but how can I use
I have created a tableview with grouped style. I have added this table to
I have created a Windows service that will run an exe file periodically to
I have created a program that prints results on command line. (It is server
I have created a windows service which is set to start automatically. This service
i have created my EditTextView with this code: mEditTxtZusatzInfo = new EditTextBackEvent(this); mEditTxtZusatzInfo.setGravity(Gravity.START); mEditTxtZusatzInfo.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);
I have created a shadow using QuartzCore for my UITextView with this following code.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.